Skip to content

gh-146636: PEP 803: add Py_TARGET_ABI3T and .abi3t.so extension#146637

Merged
encukou merged 10 commits intopython:mainfrom
encukou:abi3t-so-extension
Apr 1, 2026
Merged

gh-146636: PEP 803: add Py_TARGET_ABI3T and .abi3t.so extension#146637
encukou merged 10 commits intopython:mainfrom
encukou:abi3t-so-extension

Conversation

@encukou
Copy link
Copy Markdown
Member

@encukou encukou commented Mar 30, 2026

@bedevere-app bedevere-app bot mentioned this pull request Mar 30, 2026
7 tasks
@encukou encukou added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Mar 31, 2026
@bedevere-bot
Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @encukou for commit db32325 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F146637%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Mar 31, 2026
@encukou encukou marked this pull request as ready for review March 31, 2026 15:50
Copy link
Copy Markdown
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM.

Please document changes in the commit message:

  • Add Py_TARGET_ABI3T macro.
  • Add ".abi3t.so" to importlib EXTENSION_SUFFIXES.
  • Remove ".abi3.so" from importlib EXTENSION_SUFFIXES on Free Threading.

@vstinner
Copy link
Copy Markdown
Member

vstinner commented Apr 1, 2026

I tested manually building test_cext with Py_TARGET_ABI3T and rename the extension to test_cext.abi3t.so:

./python -m venv env
env/bin/python -m pip install setuptools 
cd Lib/test/test_cext/
CPYTHON_TEST_EXT_NAME=test_cext CPYTHON_TEST_ABI3T=1 ../../../env/bin/python setup.py build_ext 
cd build/lib.linux-x86_64-cpython-315-pydebug/
mv test_cext.cpython-315d-x86_64-linux-gnu.so test_cext.abi3t.so
cd ../../../../..
PYTHONPATH=Lib/test/test_cext/build/lib.linux-x86_64-cpython-315-pydebug/ ./python -c 'import test_cext; print(test_cext.__file__)'

Output:

Lib/test/test_cext/build/lib.linux-x86_64-cpython-315-pydebug/test_cext.abi3t.so

It works as expected (I can import the C extension named .abi3t.so).

Note: I used a debug build of Python which is not good to use the stable ABI, but it was for a quick test :-)

@encukou encukou merged commit 2452324 into python:main Apr 1, 2026
139 of 143 checks passed
@encukou encukou deleted the abi3t-so-extension branch April 1, 2026 14:15
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.

6 participants