-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
gh-128360: Use a portable assertion for holding a thread state #128361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-128360: Use a portable assertion for holding a thread state #128361
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to keep PyGILState_Check()
design: a function which returns 1 or 0, so it can be used with assert()
.
Something like: assert(_Py_HoldsTstate())
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
cc @colesbury |
@vstinner Kumar seems to dislike the current approach with
What's your preference? |
I prefer to call
Maybe it should do something if Python is built in release mode with assertions. So use |
Co-authored-by: Kumar Aditya <[email protected]>
Co-authored-by: Kumar Aditya <[email protected]>
Co-authored-by: Kumar Aditya <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
… a thread state (python#128361) Co-authored-by: Kumar Aditya <[email protected]>
PyGILState_Check
to thread state checks internally #128360