Skip to content

Commit a177916

Browse files
committed
ci: change default Python version to 3.13 (#5048)
* ci: change default Python version to 3.13 * fix FFI definition for `PyCodeObject`
1 parent 81008e1 commit a177916

File tree

7 files changed

+34
-33
lines changed

7 files changed

+34
-33
lines changed

.github/workflows/benches.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- uses: actions/checkout@v4
2121
- uses: actions/setup-python@v5
2222
with:
23-
python-version: '3.12'
23+
python-version: '3.13'
2424
- uses: dtolnay/rust-toolchain@stable
2525
with:
2626
components: rust-src

.github/workflows/changelog.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ jobs:
1212
- uses: actions/checkout@v4
1313
- uses: actions/setup-python@v5
1414
with:
15-
python-version: '3.12'
15+
python-version: '3.13'
1616
- run: python -m pip install --upgrade pip && pip install nox
1717
- run: nox -s check-changelog

.github/workflows/ci.yml

+26-28
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- uses: actions/checkout@v4
2424
- uses: actions/setup-python@v5
2525
with:
26-
python-version: "3.12"
26+
python-version: "3.13"
2727
- run: python -m pip install --upgrade pip && pip install nox
2828
- uses: dtolnay/rust-toolchain@stable
2929
with:
@@ -41,7 +41,7 @@ jobs:
4141
- uses: actions/checkout@v4
4242
- uses: actions/setup-python@v5
4343
with:
44-
python-version: "3.12"
44+
python-version: "3.13"
4545
- name: resolve MSRV
4646
id: resolve-msrv
4747
run: echo MSRV=`python -c 'import tomllib; print(tomllib.load(open("Cargo.toml", "rb"))["package"]["rust-version"])'` >> $GITHUB_OUTPUT
@@ -54,7 +54,7 @@ jobs:
5454
- uses: actions/checkout@v4
5555
- uses: actions/setup-python@v5
5656
with:
57-
python-version: "3.12"
57+
python-version: "3.13"
5858
- uses: obi1kenobi/cargo-semver-checks-action@v2
5959

6060
check-msrv:
@@ -68,7 +68,7 @@ jobs:
6868
components: rust-src
6969
- uses: actions/setup-python@v5
7070
with:
71-
python-version: "3.12"
71+
python-version: "3.13"
7272
- uses: Swatinem/rust-cache@v2
7373
with:
7474
save-if: ${{ github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'CI-save-pr-cache') }}
@@ -153,7 +153,7 @@ jobs:
153153
components: clippy,rust-src
154154
- uses: actions/setup-python@v5
155155
with:
156-
python-version: "3.12"
156+
python-version: "3.13"
157157
architecture: ${{ matrix.platform.python-architecture }}
158158
- uses: Swatinem/rust-cache@v2
159159
with:
@@ -181,7 +181,7 @@ jobs:
181181
fail-fast: ${{ !contains(github.event.pull_request.labels.*.name, 'CI-no-fail-fast') }}
182182
matrix:
183183
rust: [stable]
184-
python-version: ["3.12"]
184+
python-version: ["3.13"]
185185
platform: [
186186
{
187187
os: "macos-latest", # first available arm macos runner
@@ -218,7 +218,7 @@ jobs:
218218
# Test nightly Rust on PRs so that PR authors have a chance to fix nightly
219219
# failures, as nightly does not block merge.
220220
- rust: nightly
221-
python-version: "3.12"
221+
python-version: "3.13"
222222
platform:
223223
{
224224
os: "ubuntu-latest",
@@ -279,7 +279,7 @@ jobs:
279279
include:
280280
# Test minimal supported Rust version
281281
- rust: ${{ needs.resolve.outputs.MSRV }}
282-
python-version: "3.12"
282+
python-version: "3.13"
283283
platform:
284284
{
285285
os: "ubuntu-latest",
@@ -289,7 +289,7 @@ jobs:
289289

290290
# Test the `nightly` feature
291291
- rust: nightly
292-
python-version: "3.12"
292+
python-version: "3.13"
293293
platform:
294294
{
295295
os: "ubuntu-latest",
@@ -299,7 +299,7 @@ jobs:
299299

300300
# Run rust beta to help catch toolchain regressions
301301
- rust: beta
302-
python-version: "3.12"
302+
python-version: "3.13"
303303
platform:
304304
{
305305
os: "ubuntu-latest",
@@ -309,15 +309,15 @@ jobs:
309309

310310
# Test 32-bit Windows and x64 macOS only with the latest Python version
311311
- rust: stable
312-
python-version: "3.12"
312+
python-version: "3.13"
313313
platform:
314314
{
315315
os: "windows-latest",
316316
python-architecture: "x86",
317317
rust-target: "i686-pc-windows-msvc",
318318
}
319319
- rust: stable
320-
python-version: "3.12"
320+
python-version: "3.13"
321321
platform:
322322
{
323323
os: "macos-13",
@@ -408,9 +408,7 @@ jobs:
408408
- uses: actions/checkout@v4
409409
- uses: actions/setup-python@v5
410410
with:
411-
# FIXME valgrind detects an issue with Python 3.12.5, needs investigation
412-
# whether it's a PyO3 issue or upstream CPython.
413-
python-version: "3.12.4"
411+
python-version: "3.13"
414412
- uses: Swatinem/rust-cache@v2
415413
with:
416414
save-if: ${{ github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'CI-save-pr-cache') }}
@@ -431,7 +429,7 @@ jobs:
431429
- uses: actions/checkout@v4
432430
- uses: actions/setup-python@v5
433431
with:
434-
python-version: "3.12"
432+
python-version: "3.13"
435433
- uses: Swatinem/rust-cache@v2
436434
with:
437435
save-if: ${{ github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'CI-save-pr-cache') }}
@@ -453,7 +451,7 @@ jobs:
453451
- uses: actions/checkout@v4
454452
- uses: actions/setup-python@v5
455453
with:
456-
python-version: "3.12"
454+
python-version: "3.13"
457455
- uses: Swatinem/rust-cache@v2
458456
with:
459457
save-if: ${{ github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'CI-save-pr-cache') }}
@@ -474,7 +472,7 @@ jobs:
474472
- uses: actions/checkout@v4
475473
- uses: actions/setup-python@v5
476474
with:
477-
python-version: "3.12"
475+
python-version: "3.13"
478476
- uses: Swatinem/rust-cache@v2
479477
with:
480478
save-if: ${{ github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'CI-save-pr-cache') }}
@@ -500,7 +498,7 @@ jobs:
500498
- uses: actions/checkout@v4
501499
- uses: actions/setup-python@v5
502500
with:
503-
# TODO bump emscripten builds to test on 3.12
501+
# TODO bump emscripten builds to test on 3.13
504502
python-version: 3.11
505503
id: setup-python
506504
- name: Install Rust toolchain
@@ -622,7 +620,7 @@ jobs:
622620
- uses: actions/checkout@v4
623621
- uses: actions/setup-python@v5
624622
with:
625-
python-version: "3.12"
623+
python-version: "3.13"
626624
- uses: Swatinem/rust-cache@v2
627625
with:
628626
save-if: ${{ github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'CI-save-pr-cache') }}
@@ -646,7 +644,7 @@ jobs:
646644
- uses: actions/checkout@v4
647645
- uses: actions/setup-python@v5
648646
with:
649-
python-version: "3.12"
647+
python-version: "3.13"
650648
- uses: Swatinem/rust-cache@v2
651649
with:
652650
save-if: ${{ github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'CI-save-pr-cache') }}
@@ -672,17 +670,17 @@ jobs:
672670
# ubuntu "cross compile" to itself
673671
- os: "ubuntu-latest"
674672
target: "x86_64-unknown-linux-gnu"
675-
flags: "-i python3.12"
673+
flags: "-i python3.13"
676674
manylinux: auto
677675
# ubuntu x86_64 -> aarch64
678676
- os: "ubuntu-latest"
679677
target: "aarch64-unknown-linux-gnu"
680-
flags: "-i python3.12"
678+
flags: "-i python3.13"
681679
manylinux: auto
682680
# ubuntu x86_64 -> windows x86_64
683681
- os: "ubuntu-latest"
684682
target: "x86_64-pc-windows-gnu"
685-
flags: "-i python3.12 --features generate-import-lib"
683+
flags: "-i python3.13 --features generate-import-lib"
686684
# macos x86_64 -> aarch64
687685
- os: "macos-13" # last x86_64 macos runners
688686
target: "aarch64-apple-darwin"
@@ -692,12 +690,12 @@ jobs:
692690
# windows x86_64 -> aarch64
693691
- os: "windows-latest"
694692
target: "aarch64-pc-windows-msvc"
695-
flags: "-i python3.12 --features generate-import-lib"
693+
flags: "-i python3.13 --features generate-import-lib"
696694
steps:
697695
- uses: actions/checkout@v4
698696
- uses: actions/setup-python@v5
699697
with:
700-
python-version: "3.12"
698+
python-version: "3.13"
701699
- uses: Swatinem/rust-cache@v2
702700
with:
703701
workspaces: examples/maturin-starter
@@ -727,7 +725,7 @@ jobs:
727725
- uses: actions/checkout@v4
728726
- uses: actions/setup-python@v5
729727
with:
730-
python-version: "3.12"
728+
python-version: "3.13"
731729
- uses: Swatinem/rust-cache@v2
732730
with:
733731
workspaces: examples/maturin-starter
@@ -749,7 +747,7 @@ jobs:
749747
cargo build --manifest-path examples/maturin-starter/Cargo.toml --features abi3 --target x86_64-pc-windows-gnu
750748
cargo xwin build --cross-compiler clang --manifest-path examples/maturin-starter/Cargo.toml --features abi3 --target x86_64-pc-windows-msvc
751749
# non-abi3
752-
export PYO3_CROSS_PYTHON_VERSION=3.12
750+
export PYO3_CROSS_PYTHON_VERSION=3.13
753751
cargo build --manifest-path examples/maturin-starter/Cargo.toml --features generate-import-lib --target x86_64-pc-windows-gnu
754752
cargo xwin build --cross-compiler clang --manifest-path examples/maturin-starter/Cargo.toml --features generate-import-lib --target x86_64-pc-windows-msvc
755753
- if: ${{ github.ref == 'refs/heads/main' }}

.github/workflows/coverage-pr-base.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- uses: actions/checkout@v4
1616
- uses: actions/setup-python@v5
1717
with:
18-
python-version: '3.12'
18+
python-version: '3.13'
1919
- name: Set PR base on codecov
2020
run: |
2121
# fetch the merge commit between the PR base and head

.github/workflows/gh-pages.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- uses: actions/checkout@v4
2525
- uses: actions/setup-python@v5
2626
with:
27-
python-version: '3.12'
27+
python-version: '3.13'
2828
- uses: dtolnay/rust-toolchain@nightly
2929

3030
- name: Setup mdBook

newsfragments/5048.fixed.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix size of `PyCodeObject::_co_instrumentation_version` ffi struct member on Python 3.13 for systems where `uintptr_t` is not 64 bits.

pyo3-ffi/src/cpython/code.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,10 @@ pub struct PyCodeObject {
184184
pub co_executors: *mut _PyExecutorArray,
185185
#[cfg(Py_3_12)]
186186
pub _co_cached: *mut _PyCoCached,
187-
#[cfg(Py_3_12)]
187+
#[cfg(all(Py_3_12, not(Py_3_13)))]
188188
pub _co_instrumentation_version: u64,
189+
#[cfg(Py_3_13)]
190+
pub _co_instrumentation_version: libc::uintptr_t,
189191
#[cfg(Py_3_12)]
190192
pub _co_monitoring: *mut _PyCoMonitoringData,
191193
pub _co_firsttraceable: c_int,

0 commit comments

Comments
 (0)