{{ message }}
gh-146636: abi3t: Define Py_GIL_DISABLED but do not to use it - #148142
Merged
Merged
Conversation
…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.
9 tasks
encukou
marked this pull request as draft
April 5, 2026 21:38
encukou
marked this pull request as ready for review
April 6, 2026 08:55
|
🤖 New build scheduled with the buildbot fleet by @encukou for commit 1cd72a7 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F148142%2Fmerge If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again. |
Member
Author
|
Some paths still use |
ljfp
pushed a commit
to ljfp/cpython
that referenced
this pull request
Apr 25, 2026
…honGH-148142) When compiling for abi3t, define Py_GIL_DISABLED, so that users who check it to enable additional locking aren't broken. But also avoid using Py_GIL_DISABLED in Python headers themselves -- abi3 and abi3t ought to be the same except the _Py_OPAQUE_PYOBJECT differences. A check for this is coming in a later PR. It will require rewriting some preprocessor conditions, some of these changes are included in this PR. For _Py_IsOwnedByCurrentThread & supporting functions I opted to move them to a cpython/ header, as they're rather self-contained.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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, sinceabi3andabi3tought to be the same except the_Py_OPAQUE_PYOBJECTdifferences.This is done using the GCC-only
poisonpragma, which tells the compiler/preprocessor to error if it ever sees the identifier after thepragma.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 acpython/header, as they're rather self-contained.