Skip to content

Fix ABI3T feature selection for free-threaded Python - #622

Open
jameshilliard wants to merge 2 commits into
PyO3:mainfrom
jameshilliard:fix/abi3t-features
Open

jameshilliard wants to merge 2 commits into
PyO3:mainfrom
jameshilliard:fix/abi3t-features

Conversation

@jameshilliard

Copy link
Copy Markdown
Contributor

py_limited_api=cp315 currently enables pyo3/abi3-py315 even when targeting free-threaded Python. With recent setuptools, the extension receives an ABI3T filename and stable-ABI wheel tags, but PyO3 falls back to a version-specific free-threaded ABI.

Use Py_GIL_DISABLED from the target sysconfig data to select PyO3's abi3t features for free-threaded builds. Preserve ABI3 selection for GIL-enabled builds and leave explicit extension settings unchanged.

Add regression tests for both ABI choices, unset configuration, explicit extension settings, and other binding types. Document the cp315 minimum for PyO3 ABI3T builds and add a changelog entry.

Testing

  • Project tests: 25 passed with setuptools 84.2.1.
  • Ruff lint and formatting checks, and mypy passed.
  • Cross-built an AArch64 wheel using a synthetic Python 3.15t sysconfig and PyO3 0.29.3. Verified the pyo3/abi3t-py315 feature, ABI3T extension filename, wheel tags, and exported PyModExport_rust entry point. This was not runtime-tested on Python 3.15t.

Build the ABI3 example on Python 3.11 and test it on the latest Python. Building on 3.15 produces platform-qualified suffixes that Python 3.11 cannot import.

Use the stdlib venv backend for GraalPy on Windows, where virtualenv fails to import IO_REPARSE_TAG_MOUNT_POINT from stat.

Test the Zig-built wheel in the Python 3.10 container using the existing QEMU setup action. This avoids installing Ubuntu packages under emulation, where the libc-bin post-installation step crashes.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant