-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
PEP 803: Stable ABI for Free-Threaded Builds #4556
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, some small comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @encukou. I've made a few readability suggestions.
peps/pep-0803.rst
Outdated
that is, only a subset of the functions, structures, etc. that CPython | ||
exposes. | ||
The limited API is versioned, and building against Limited API 3.X | ||
yields an extension that is ABI-compatible with CPython 3.X *and above* (modulo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what "modulo bugs" means in this sentence.
However, CPython will add a line of defense against outdated or misconfigured | ||
tools, or human mistakes, in the form of a new *module slot* containing | ||
basic ABI information. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However, CPython will add a line of defense against outdated or misconfigured | |
tools, or human mistakes, in the form of a new *module slot* containing | |
basic ABI information. | |
However, CPython will help defend against outdated or misconfigured | |
tools, or human mistakes, in the form of a new *module slot* containing | |
basic ABI information. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think my wording better suggests that we're adding a distinct mechanism.
This information will be checked when a module is loaded, and incompatible | ||
extensions will be rejected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This information will be checked when a module is loaded, and incompatible | |
extensions will be rejected. | |
Checks will be done when a module is loaded, and incompatible | |
extensions will be rejected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to say which information is checked (with “this” referring to the previous sentence).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the reviews!
Sometimes I have reasons for a particular wording, and copy editing helps make the nuances stand out :)
Projects that need this can build separate extensions specifically for | ||
the 3.14 free-threaded interpreter, and for older stable ABI versions. | ||
|
||
API changes are OK |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's what the next sentence says. Do you think the 4 words don't make sense as a heading?
This information will be checked when a module is loaded, and incompatible | ||
extensions will be rejected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to say which information is checked (with “this” referring to the previous sentence).
However, CPython will add a line of defense against outdated or misconfigured | ||
tools, or human mistakes, in the form of a new *module slot* containing | ||
basic ABI information. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think my wording better suggests that we're adding a distinct mechanism.
Users -- or rather the tools they use for building and installing extensions -- | ||
will continue to be responsible for not putting incompatible extensions on | ||
Python's import paths. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tools can only be responsible for their own actions; they're not expected to prevent anything else from messing things up.
- :c:type:`!PyModuleDef_Base` | ||
- :c:type:`PyModuleDef` | ||
|
||
- no longer include the following macros: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to keep the current wording if you don't mind.
AFAIK, “exclude” sounds more like “prevent from being included” or “expel” than a passive “not include”. (And a few dictionaries I checked at least put the definitions in this order.)
Co-authored-by: Carol Willing <[email protected]> Co-authored-by: Jelle Zijlstra <[email protected]>
@AA-Turner, are you working on a review? |
Yes, sorry for the delay. I've been unexpectedly busy, should have it finished by Thursday. A |
Please send what you have, or leave it for the next round. I'd like to publish the PEP next week. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay Petr, I've written up the notes I had & done a brief editorial/style pass.
A
@@ -0,0 +1,322 @@ | |||
PEP: 803 | |||
Title: Stable ABI for Free-Threaded Builds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to clarify that this is for CPython?
Status: Draft | ||
Type: Standards Track | ||
Requires: 703, 793, 697 | ||
Created: 08-Aug-2025 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the date of formal number assignment
Created: 08-Aug-2025 | |
Created: 19-Aug-2025 |
|
||
Stable ABI 3.15 will be compatible with both free-threaded and GIL-enabled | ||
builds. | ||
To allow this, the ``PyObject`` internal structure and related APIs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To allow this, the ``PyObject`` internal structure and related APIs | |
To allow this, the :c:type:`PyObject` internal structure and related APIs |
Stable ABI 3.15 will be compatible with both free-threaded and GIL-enabled | ||
builds. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grammar, this reads slightly oddly to me. Perhaps "Version 3.15 of the Stable ABI will be ...", or "The Stable ABI version 3.15 will be ..."?
Stable ABI 3.15 will be compatible with both free-threaded and GIL-enabled | ||
builds. | ||
To allow this, the ``PyObject`` internal structure and related APIs | ||
will be removed from the Limited API, requiring migration to new API |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume removed only for the 3.15 / 0x030F0000
version level, rather than entirely?
New Export Hook (PEP 793) | ||
------------------------- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New Export Hook (PEP 793) | |
------------------------- | |
New Export Hook (:pep:`793`) | |
---------------------------- |
|
||
The following functions will become unusable in practice (in the new Limited | ||
API), since an extension cannot create valid, statically allocated, input | ||
for them. To ease the transition for extension developers, they will not yet be removed from the Limited API: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line length (please stick to 79)
|
||
This slot will become *mandatory* with the new export hook added in | ||
:pep:`793`. | ||
(The PEP currently says “there are no required slots”; it will be updated.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(The PEP currently says “there are no required slots”; it will be updated.) | |
(That PEP currently says “there are no required slots”; it will be updated.) |
|
||
- Opaque ``PyObject`` is available in CPython main branch after defining the | ||
``_Py_OPAQUE_PYOBJECT`` macro. | ||
Implemented in GitHub pull request `#136505 <https://github.com/python/cpython/pull/136505>`__. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented in GitHub pull request `#136505 <https://github.com/python/cpython/pull/136505>`__. | |
Implemented in GitHub pull request `python/cpython#136505 | |
<https://github.com/python/cpython/pull/136505>`__. |
- For a version-checking slot, see GitHub pull request `#137212 <https://github.com/python/cpython/pull/137212>`__. | ||
- For a check for older ``abi3``, see GitHub pull request `#137957 <https://github.com/python/cpython/pull/137957>`__. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- For a version-checking slot, see GitHub pull request `#137212 <https://github.com/python/cpython/pull/137212>`__. | |
- For a check for older ``abi3``, see GitHub pull request `#137957 <https://github.com/python/cpython/pull/137957>`__. | |
- For a version-checking slot, see GitHub pull request `python/cpython#137212 | |
<https://github.com/python/cpython/pull/137212>`__. | |
- For a check for older ``abi3``, see GitHub pull request `python/cpython#137957 | |
<https://github.com/python/cpython/pull/137957>`__. |
Basic requirements (all PEP Types)
pep-NNNN.rst
), PR title (PEP 123: <Title of PEP>
) andPEP
headerAuthor
orSponsor
, and formally confirmed their approvalAuthor
,Status
(Draft
),Type
andCreated
headers filled out correctlyPEP-Delegate
,Topic
,Requires
andReplaces
headers completed if appropriate.github/CODEOWNERS
for the PEPStandards Track requirements
Python-Version
set to valid (pre-beta) future Python version, if relevantDiscussions-To
andPost-History
📚 Documentation preview 📚: https://pep-previews--4556.org.readthedocs.build/