From cc7d40a0b74b1853f553fc231d3eafa0e422fe4a Mon Sep 17 00:00:00 2001 From: Nathan Goldbaum Date: Thu, 26 Mar 2026 08:28:58 -0600 Subject: [PATCH 1/4] Add `abi3-py315` feature --- Cargo.toml | 3 ++- noxfile.py | 8 ++------ pyo3-build-config/src/impl_.rs | 2 +- pyo3-ffi/Cargo.toml | 3 ++- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index bb707bf06f5..4cc7f4245d0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -122,7 +122,8 @@ abi3-py310 = ["abi3-py311", "pyo3-ffi/abi3-py310"] abi3-py311 = ["abi3-py312", "pyo3-ffi/abi3-py311"] abi3-py312 = ["abi3-py313", "pyo3-ffi/abi3-py312"] abi3-py313 = ["abi3-py314", "pyo3-ffi/abi3-py313"] -abi3-py314 = ["abi3", "pyo3-ffi/abi3-py314"] +abi3-py314 = ["abi3-py315", "pyo3-ffi/abi3-py314"] +abi3-py315 = ["abi3", "pyo3-ffi/abi3-py315"] # deprecated: no longer needed, raw-dylib is used instead generate-import-lib = ["pyo3-ffi/generate-import-lib"] diff --git a/noxfile.py b/noxfile.py index 1e1a7920c29..e510a8a114d 100644 --- a/noxfile.py +++ b/noxfile.py @@ -85,10 +85,7 @@ def _supported_interpreter_versions( PY_VERSIONS = _supported_interpreter_versions("cpython") -# We don't yet support abi3-py315 but do support cp315 and cp315t -# version-specific builds ABI3_PY_VERSIONS = [p for p in PY_VERSIONS if not p.endswith("t")] -ABI3_PY_VERSIONS.remove("3.15") PYPY_VERSIONS = _supported_interpreter_versions("pypy") @@ -1208,9 +1205,8 @@ def test_version_limits(session: nox.Session): # 3.16 CPython should build if abi3 is explicitly requested _run_cargo(session, "check", "--features=pyo3/abi3", env=env) - # 3.15 CPython should build with forward compatibility - # TODO: check on 3.16 when adding abi3-py315 support - config_file.set("CPython", "3.15") + # 3.16 CPython should build with forward compatibility + config_file.set("CPython", "3.16") env["PYO3_USE_ABI3_FORWARD_COMPATIBILITY"] = "1" _run_cargo(session, "check", env=env) diff --git a/pyo3-build-config/src/impl_.rs b/pyo3-build-config/src/impl_.rs index ea6653d145c..067cff94e29 100644 --- a/pyo3-build-config/src/impl_.rs +++ b/pyo3-build-config/src/impl_.rs @@ -41,7 +41,7 @@ const MINIMUM_SUPPORTED_VERSION_GRAALPY: PythonVersion = PythonVersion { }; /// Maximum Python version that can be used as minimum required Python version with abi3. -pub(crate) const ABI3_MAX_MINOR: u8 = 14; +pub(crate) const ABI3_MAX_MINOR: u8 = 15; #[cfg(test)] thread_local! { diff --git a/pyo3-ffi/Cargo.toml b/pyo3-ffi/Cargo.toml index 2144fbfa61c..6d6b0949d46 100644 --- a/pyo3-ffi/Cargo.toml +++ b/pyo3-ffi/Cargo.toml @@ -32,7 +32,8 @@ abi3-py310 = ["abi3-py311"] abi3-py311 = ["abi3-py312"] abi3-py312 = ["abi3-py313"] abi3-py313 = ["abi3-py314"] -abi3-py314 = ["abi3"] +abi3-py314 = ["abi3-py315"] +abi3-py315 = ["abi3"] # deprecated: no longer needed, raw-dylib is used instead generate-import-lib = ["pyo3-build-config/generate-import-lib"] From ba6349a46b0e02f84636c741b7e0074472ac36b4 Mon Sep 17 00:00:00 2001 From: David Hewitt Date: Mon, 11 May 2026 22:12:38 +0100 Subject: [PATCH 2/4] bump supported CPython version to 3.15 --- pyo3-ffi/build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyo3-ffi/build.rs b/pyo3-ffi/build.rs index e59b7ba5eeb..8802736e835 100644 --- a/pyo3-ffi/build.rs +++ b/pyo3-ffi/build.rs @@ -18,7 +18,7 @@ const SUPPORTED_VERSIONS_CPYTHON: SupportedVersions = SupportedVersions { min: PythonVersion { major: 3, minor: 8 }, max: PythonVersion { major: 3, - minor: 14, + minor: 15, }, }; From 8049f38e9f76aa925470577b52d1f336cc5bc890 Mon Sep 17 00:00:00 2001 From: Nathan Goldbaum Date: Mon, 11 May 2026 20:38:52 -0600 Subject: [PATCH 3/4] adjust PyMutex cfg gating --- pyo3-ffi/src/critical_section.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pyo3-ffi/src/critical_section.rs b/pyo3-ffi/src/critical_section.rs index 9249df7aad4..ca585287d43 100644 --- a/pyo3-ffi/src/critical_section.rs +++ b/pyo3-ffi/src/critical_section.rs @@ -1,9 +1,12 @@ -#[cfg(any(all(Py_GIL_DISABLED, Py_3_13, not(Py_LIMITED_API)), Py_3_15,))] +#[cfg(any( + all(Py_GIL_DISABLED, Py_3_13, not(Py_LIMITED_API)), + all(Py_3_15, not(Py_LIMITED_API)) +))] use crate::PyMutex; #[cfg(any(all(Py_GIL_DISABLED, Py_3_13), Py_3_15))] use crate::PyObject; -#[cfg(all(Py_LIMITED_API, Py_3_13, not(Py_3_15)))] +#[cfg(all(Py_LIMITED_API, Py_3_13))] opaque_struct!(pub PyMutex); #[cfg(any(all(Py_GIL_DISABLED, Py_3_13, not(Py_LIMITED_API)), Py_3_15,))] From cf229851fb79a50c2ca23ac0de9e308e67b56ecd Mon Sep 17 00:00:00 2001 From: David Hewitt Date: Tue, 12 May 2026 07:01:48 +0100 Subject: [PATCH 4/4] fixup `test-version-limits` --- noxfile.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/noxfile.py b/noxfile.py index e510a8a114d..e2e83d0d9af 100644 --- a/noxfile.py +++ b/noxfile.py @@ -1198,18 +1198,26 @@ def test_version_limits(session: nox.Session): config_file.set("CPython", "3.6") _run_cargo(session, "check", env=env, expect_error=True) + # We allow building with our max version + 1, to support + # development work assert "3.16" not in PY_VERSIONS config_file.set("CPython", "3.16") + _run_cargo(session, "check", env=env) + + # We do not allow allow building with max version + 2 + assert "3.17" not in PY_VERSIONS + config_file.set("CPython", "3.17") _run_cargo(session, "check", env=env, expect_error=True) - # 3.16 CPython should build if abi3 is explicitly requested + # max version + 2 should build if abi3 is explicitly requested _run_cargo(session, "check", "--features=pyo3/abi3", env=env) - # 3.16 CPython should build with forward compatibility + # ... and also should build with forward compatibility config_file.set("CPython", "3.16") env["PYO3_USE_ABI3_FORWARD_COMPATIBILITY"] = "1" _run_cargo(session, "check", env=env) + # we only support 3.11 PyPy assert "3.10" not in PYPY_VERSIONS config_file.set("PyPy", "3.10") _run_cargo(session, "check", env=env, expect_error=True)