I am working on ecosystem support for the free-threaded build of Python. Lately I've been thinking about PEP 803, which proposes a new version of the stable ABI that can support the free-threaded build.
Yesterday, while working on a test to validate the possibility of distributing .abi3t.so extensions that are loadable on both builds, I realized that currently Meson hard-codes the index into importlib.machinery.EXTENSION_SUFFIXES to find the suffix to use at build time:
|
limited_api_suffix = None |
|
if sys.version_info >= (3, 2): |
|
try: |
|
from importlib.machinery import EXTENSION_SUFFIXES |
|
limited_api_suffix = EXTENSION_SUFFIXES[1] |
|
except Exception: |
|
pass |
For reference, on my Mac:
goldbaum at Nathans-MBP in ~
○ python
Python 3.14.3 free-threading build (main, Feb 10 2026, 08:41:08) [Clang 17.0.0 (clang-1700.6.3.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import importlib.machinery
>>> importlib.machinery.EXTENSION_SUFFIXES
['.cpython-314t-darwin.so', '.abi3.so', '.so']
Even if PEP 803 doesn't go into CPython for the 3.15 release cycle, IMO it's still worth adding some way for a user to supply the extension name and override that, but still verify that the provided extension suffix is present in the EXTENSION_SUFFIXES list provided by the interpreter. This also has bearing on other proposals from Debian to modify this list: python/cpython#122917. I'm not sure offhand if Debian carries a patch for this.
Once there's a UI in meson, then meson-python can be updated to select the correct extension name depending on the project's build configuration.
Ping @mgorny who I chatted with a little about this.
I am working on ecosystem support for the free-threaded build of Python. Lately I've been thinking about PEP 803, which proposes a new version of the stable ABI that can support the free-threaded build.
Yesterday, while working on a test to validate the possibility of distributing
.abi3t.soextensions that are loadable on both builds, I realized that currently Meson hard-codes the index intoimportlib.machinery.EXTENSION_SUFFIXESto find the suffix to use at build time:meson/mesonbuild/scripts/python_info.py
Lines 95 to 101 in fb12c9c
For reference, on my Mac:
Even if PEP 803 doesn't go into CPython for the 3.15 release cycle, IMO it's still worth adding some way for a user to supply the extension name and override that, but still verify that the provided extension suffix is present in the
EXTENSION_SUFFIXESlist provided by the interpreter. This also has bearing on other proposals from Debian to modify this list: python/cpython#122917. I'm not sure offhand if Debian carries a patch for this.Once there's a UI in meson, then meson-python can be updated to select the correct extension name depending on the project's build configuration.
Ping @mgorny who I chatted with a little about this.