Skip to content

gh-146636: PEP 803: Reference documentation#148013

Open
encukou wants to merge 4 commits intopython:mainfrom
encukou:803-docs
Open

gh-146636: PEP 803: Reference documentation#148013
encukou wants to merge 4 commits intopython:mainfrom
encukou:803-docs

Conversation

@encukou
Copy link
Copy Markdown
Member

@encukou encukou commented Apr 2, 2026


.. _whatsnew315-abi3t:

:pep:`903`: ``abi3t`` -- Stable ABI for Free-Threaded Builds
Copy link
Copy Markdown

@AIdjis AIdjis Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seems to be a typo in the documentation: 903should be 803

part of the instance struct; and
- Switching from a ``PyInit_`` function to a new export hook,
:c:func:`PyModExport_* <PyModExport_modulename>`, introduced for this
purpose in :pep:`903`.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the same here as well : purpose in :pep:803

Copy link
Copy Markdown
Member

@ZeroIntensity ZeroIntensity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Congrats on the PEP acceptance :)

Mostly editorial comments from me. The content generally looks good.

Comment on lines +688 to +691
In the :ref:`Stable ABI <stable-abi>` for Free-Threaded Builds (``abi3t``),
this struct is opaque, and unusable in practice.
The struct, including all members, is part of Stable ABI for
non-free-threaded builds (``abi3``).
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is "Free-Threaded Builds" in title case, but then "non-free-threaded builds" isn't?


.. c:macro:: Py_LIMITED_API
- ``abi3``, introduced in Pyton 3.2, is compatible with
**non**-:term:`free threaded <free-threaded build>` builds of CPython.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpicky, but I believe "free threaded" needs a dash here. In the original issue where we added the "free-threaded build" term (#144277), we determined that no dash was correct only when "free threaded" was a noun.

Comment on lines +221 to +223
Note that compiling for Stable ABI is *not* a complete guarantee that code will
be compatible with the expected Python versions.
Stable ABI prevents *ABI* issues, like linker errors due to missing
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to precede "Stable ABI" with "the"?

Suggested change
Note that compiling for Stable ABI is *not* a complete guarantee that code will
be compatible with the expected Python versions.
Stable ABI prevents *ABI* issues, like linker errors due to missing
Note that compiling for the Stable ABI is *not* a complete guarantee that code will
be compatible with the expected Python versions.
The Stable ABI prevents *ABI* issues, like linker errors due to missing

symbols or data corruption due to changes in structure layouts or function
signatures.
However, other changes in Python can change the *behavior* of extensions.
See Python's Backwards Compatibility Policy (:pep:`387`) for details.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence confused me a little when I first read it. I had read it as "We might change the behavior of extensions -- go read our backward compatibility policy if you want to know what", but then we provide an example right after the reader was diverted. Could we move this sentence to after the following paragraph, or put it in a seealso note?

C extensions that target the :ref:`Stable ABI <stable-abi>` can now be
compiled for the new *Stable ABI for Free-Threaded Builds* (also known
as ``abi3t``), which makes them compatible with
:term:`free-threaded build <free-threaded build>` builds of CPython.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
:term:`free-threaded build <free-threaded build>` builds of CPython.
:term:`free-threaded <free-threaded build>` builds of CPython.

part of the instance struct; and
- Switching from a ``PyInit_`` function to a new export hook,
:c:func:`PyModExport_* <PyModExport_modulename>`, introduced for this
purpose in :pep:`903`.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
purpose in :pep:`903`.
purpose in :pep:`803`.

:c:func:`PyModExport_* <PyModExport_modulename>`, introduced for this
purpose in :pep:`903`.

Note that Stable ABI does not offer all functionality CPython has to offer.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Note that Stable ABI does not offer all functionality CPython has to offer.
Note that the Stable ABI does not offer all the functionality that CPython has to offer.

Or if you don't like "the" before "Stable ABI":

Suggested change
Note that Stable ABI does not offer all functionality CPython has to offer.
Note that Stable ABI does not offer all the functionality that CPython has to offer.

Comment on lines +411 to +412
be selected in a build tool (such as Setuptools, ``meson-python``, Cython,
Scikit-build-core, Maturin, and similar).
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it intentional that meson-python is the only package in a code block here?

be selected in a build tool (such as Setuptools, ``meson-python``, Cython,
Scikit-build-core, Maturin, and similar).
At the time of writing this entry, these tools did **not** support ``abi3t``.
If this is the case for "your" tool, compile for ``cp315t`` separately.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, why is "your" in quotes?

At the time of writing this entry, these tools did **not** support ``abi3t``.
If this is the case for "your" tool, compile for ``cp315t`` separately.
If not using a build tool -- or when writing such a tool -- you can select
``abi3t`` by setting the macro :c:macro:`!Py_TARGET_ABI3T` as discussed
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd be nice if the Py_TARGET_ABI3T were an actual link, because it's not linked anywhere else in this section.

Suggested change
``abi3t`` by setting the macro :c:macro:`!Py_TARGET_ABI3T` as discussed
``abi3t`` by setting the macro :c:macro:`Py_TARGET_ABI3T` as discussed

@StanFromIreland
Copy link
Copy Markdown
Member

The new check caught removals: https://github.com/python/cpython/actions/runs/23907059205/job/69719041532?pr=148013 (and on your PR out of everyone's ;-)

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants