Programming · free software · the open webSubscribe via RSS

Python’s `abi3t` widens compatibility, not the thread-safety proof

Python 3.15 adds a Stable ABI for free-threaded CPython extensions. The new `abi3t` target can ease wheel maintenance, but its narrower API and separate concurrency obligations matter as much as its compatibility promise.

A new ABI arrives with Python 3.15

Python 3.15.0 was released on 9 October 2026. Among its C API changes is a Stable ABI for free-threaded builds, called abi3t. The existing abi3 contract covers conventional CPython builds; abi3t supplies a corresponding compatibility target for interpreters built without the global interpreter lock. This is a release fact, not a claim that Python 3.15 makes free-threading the default. [1] [2] [4]

The motivation is familiar to anyone shipping a native extension: a version-specific wheel matrix grows across Python versions, operating systems and processor architectures. The stable ABI can let a binary built against one supported minimum version serve later versions, reducing repeat builds and release coordination. Free-threaded CPython previously lacked that stable target, so its extensions faced a separate per-version ABI line. abi3t gives maintainers a way to reduce that particular axis of the matrix.

Compatibility comes from an intentionally smaller interface

A stable ABI is a promise about binary interfaces that remain usable across interpreter minor releases. It is not a promise that every CPython C API is frozen. Extensions must restrict themselves to the documented limited API, and the free-threaded target adds further restrictions. In particular, the Python 3.15 guidance calls out making PyObject opaque to extension code rather than embedding it directly in an extension’s instance layout. That costs some implementation freedom in exchange for a boundary CPython can maintain. [3] [4]

The migration can involve module initialization too. Python 3.15’s release notes point to a new export hook, PyModExport_*, and a slot-based module definition for this purpose. An extension tied to legacy structure layouts or APIs outside the supported subset cannot become abi3t just by changing a wheel filename. It may remain on a version-specific free-threaded ABI, keep shipping separate builds, or refactor toward the stable surface. The ABI tag should describe what the binary was built to satisfy, not what its maintainer hopes it supports.

A wheel tag is a selection rule, not a test result

Wheel tags let installers filter distributions by Python implementation, ABI and platform. They are metadata for compatibility selection. The ABI portion answers which binary interface a module expects; it does not certify that the extension correctly handles concurrent access to Python objects. A package can be loadable under the advertised ABI and still contain data races, unsafe borrowed-reference use or assumptions that were valid only while the GIL serialized execution. [3] [4]

The free-threading guide makes that second obligation concrete. Some APIs that return borrowed references are unsafe when another thread can modify the containing object; container access patterns that rely on unchecked macros may need synchronization or stronger-reference APIs. Extensions also need to declare that they support running with the GIL disabled. Otherwise, importing one can cause the interpreter to warn and enable the GIL at runtime. abi3t addresses binary compatibility; the declaration and code review address whether the extension is prepared for concurrent execution. [5]

Treat adoption as two separate migrations

A practical port plan starts with two inventories. First list the C API surface the module actually uses: direct structure access, initialization entry points, private or unstable calls, and any dependency on a version-specific symbol. Compare that list to the 3.15 limited API and change only the uses that block the target. Then trace shared mutable state and object lifetimes: which threads can touch each object, whether references remain valid while another thread mutates a container, and where locks or ownership transfer provide the required exclusion. The first inventory is about a stable binary contract; the second is about runtime correctness.

For a package that can satisfy both contracts, build and test the stable target across the interpreter versions it claims to support, on both GIL-enabled and free-threaded runtimes as applicable. Keep a version-specific wheel where the limited API lacks a necessary capability. Run concurrency-focused tests under the free-threaded build; an import succeeding is only a load test. And check the produced wheel tags rather than assuming a build backend inferred the intended target. Python’s C API guidance recommends using build-tool support for selecting ABI macros and keeping them synchronized with filenames and metadata. [4] [3]

The useful promise in Python 3.15 is therefore deliberately bounded: a compatible extension can avoid rebuilding for each later free-threaded CPython minor release, provided it stays within abi3t’s supported API. It does not convert a GIL-dependent module into a concurrent one, and it does not remove platform-specific builds. Separating those claims helps maintainers make a reliable release plan: ABI stability is a distribution property; thread-safety is a property of the implementation and its tests. [2] [5]

References

  1. Python 3.15.0 release
  2. What’s New in Python 3.15
  3. PEP 803: Stable ABI for Free-Threaded Builds
  4. C API and ABI Stability
  5. C API Extension Support for Free Threading

Suggest a correction · All posts