Skip to content

gh-146636: abi3t: Define Py_GIL_DISABLED but make sure not to use it#148142

Open
encukou wants to merge 1 commit intopython:mainfrom
encukou:abi3t-pygildisabled
Open

gh-146636: abi3t: Define Py_GIL_DISABLED but make sure not to use it#148142
encukou wants to merge 1 commit intopython:mainfrom
encukou:abi3t-pygildisabled

Conversation

@encukou
Copy link
Copy Markdown
Member

@encukou encukou commented Apr 5, 2026

When compiling for abi3t, define Py_GIL_DISABLED, so that users who check it to enable additional locking aren't broken.

But also add a test that Python headers themselves don't use Py_GIL_DISABLED, since abi3 and abi3t ought to be the same except the _Py_OPAQUE_PYOBJECT differences.
This is done using the GCC-only poison pragma, which tells the compiler/preprocessor to error if it ever sees the identifier after the pragma.
This did require rewriting some preprocessor conditions -- #if defined(Py_LIMITED_API) && defined(Py_GIL_DISABLED) needs to be split into two lines, as the poisoning doesn't honour short-circuiting.
For _Py_IsOwnedByCurrentThread & supporting functions I opted to move them to a cpython/ header, as they're rather self-contained.

…se it

When compiling for abi3t, define Py_GIL_DISABLED, so that users who
check it to enable additional locking aren't broken.

But also add a test that Python headers themselves don't use
Py_GIL_DISABLED -- abi3 and abi3t ought to be the same except
the _Py_OPAQUE_PYOBJECT differences.
This is done using the GCC-only poison pragma.
This did require rewriting some preprocessor conditions, and
moving _Py_IsOwnedByCurrentThread & supporting functions
to a cpython/ header.
@bedevere-app bedevere-app bot mentioned this pull request Apr 5, 2026
8 tasks
@encukou encukou marked this pull request as draft April 5, 2026 21:38
@encukou encukou marked this pull request as ready for review April 6, 2026 08:55
@encukou encukou added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Apr 6, 2026
@bedevere-bot
Copy link
Copy Markdown

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

Results will be shown at:

https://un5h20eeybzp4em2p7qwc9h0br.julianrbryant.com/all/#/grid?branch=refs%2Fpull%2F148142%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 Apr 6, 2026
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.

2 participants