@@ -5,17 +5,17 @@ Discussions-To: Pending
55Status: Draft
66Type: Standards Track
77Requires: 703, 793, 697
8- Created: 08 -Aug-2025
8+ Created: 19 -Aug-2025
99Python-Version: 3.15
1010
1111
1212Abstract
1313========
1414
15- Stable ABI 3.15 will be compatible with both free-threaded and GIL-enabled
16- builds.
17- To allow this, the `` PyObject ` ` internal structure and related APIs
18- will be removed from the Limited API, requiring migration to new API
15+ Version 3.15 of the Stable ABI will be compatible with both free-threaded and
16+ GIL-enabled builds.
17+ To allow this, the :c:type: ` PyObject ` internal structure and related APIs
18+ will be removed from version 3.15 of the Limited API, requiring migration to new API
1919for common tasks like defining modules and most classes.
2020
2121
@@ -29,6 +29,11 @@ that is, an interpreter or extension built without ``Py_GIL_DISABLED``.
2929Motivation
3030==========
3131
32+ The Stable ABI is currently not available for free-threaded builds.
33+ Extensions will fail to build when :c:macro: `Py_LIMITED_API ` is defined,
34+ and extensions built for GIL-enabled builds of CPython will fail to load (or crash)
35+ on free-threaded builds.
36+
3237In its `acceptance post <https://discuss.python.org/t/84319/123 >`__
3338for :pep: `779 `, the Steering Council stated that it “expects that Stable ABI
3439for free-threading should be prepared and defined for Python 3.15”.
@@ -42,9 +47,10 @@ Background
4247Python's Stable ABI, as defined in :pep: `384 ` and :pep: `652 `, provides a way to
4348compile extension modules that can be loaded on multiple versions of the
4449CPython interpreter.
45- Several projects use this to limit the number of *wheels * (binary artefacts)
50+ Several projects use this to limit the number of
51+ :ref: `wheels <packaging:binary-distribution-format >` (binary artefacts)
4652that need to be built and distributed for each release, and/or to make it
47- possible to test with pre-release versions of Python.
53+ easier to test with pre-release versions of Python.
4854
4955With free-threading builds (:pep: `703 `) being on track to eventually become
5056the default (:pep: `779 `), we need a way to make the Stable ABI available
@@ -124,7 +130,7 @@ Implications
124130Making the ``PyObject ``, ``PyVarObject `` and ``PyModuleDef `` structures
125131opaque means:
126132
127- - Their fields may not be accessed.
133+ - Their fields may not be directly accessed.
128134
129135 For example, instead of ``o->ob_type ``, extensions must use
130136 ``Py_TYPE(o) ``.
@@ -147,15 +153,16 @@ opaque means:
147153
148154The following functions will become unusable in practice (in the new Limited
149155API), since an extension cannot create valid, statically allocated, input
150- for them. To ease the transition for extension developers, they will not yet be removed from the Limited API:
156+ for them. To ease the transition for extension developers,
157+ they will not yet be removed from the Limited API:
151158
152159- :c:func: `PyModuleDef_Init `
153160- :c:func: `PyModule_Create `, :c:func: `PyModule_Create2 `
154161- :c:func: `PyModule_FromDefAndSpec `, :c:func: `PyModule_FromDefAndSpec2 `
155162
156163
157- New Export Hook (PEP 793)
158- -------------------------
164+ New Export Hook (:pep: ` 793 ` )
165+ ----------------------------
159166
160167Implementation of this PEP requires :pep: `793 ` (``PyModExport ``:
161168A new entry point for C extension modules) to be
@@ -182,7 +189,7 @@ The specifics are left to the C API working group
182189
183190This slot will become *mandatory * with the new export hook added in
184191:pep: `793 `.
185- (The PEP currently says “there are no required slots”; it will be updated.)
192+ (That PEP currently says “there are no required slots”; it will be updated.)
186193
187194
188195Check for older ``abi3 ``
@@ -257,10 +264,13 @@ This PEP combines several pieces, implemented individually:
257264
258265- Opaque ``PyObject `` is available in CPython main branch after defining the
259266 ``_Py_OPAQUE_PYOBJECT `` macro.
260- Implemented in GitHub pull request `#136505 <https://github.com/python/cpython/pull/136505 >`__.
267+ Implemented in GitHub pull request `python/cpython#136505
268+ <https://github.com/python/cpython/pull/136505> `__.
261269- For ``PyModExport ``, see :pep: `793 `.
262- - For a version-checking slot, see GitHub pull request `#137212 <https://github.com/python/cpython/pull/137212 >`__.
263- - For a check for older ``abi3 ``, see GitHub pull request `#137957 <https://github.com/python/cpython/pull/137957 >`__.
270+ - For a version-checking slot, see GitHub pull request `python/cpython#137212
271+ <https://github.com/python/cpython/pull/137212> `__.
272+ - For a check for older ``abi3 ``, see GitHub pull request `python/cpython#137957
273+ <https://github.com/python/cpython/pull/137957> `__.
264274- For wheel tags, there is no implementation yet.
265275- A porting guide is not yet written.
266276
0 commit comments