Deprecate and Then Remove PyGILState_GetThisThreadState() #131265
Labels
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
topic-C-API
type-feature
A feature request or enhancement
Uh oh!
There was an error while loading. Please reload this page.
Feature or enhancement
Proposal:
(See https://docs.python.org/3/c-api/init.html#c.PyGILState_GetThisThreadState.)
PyGILState_GetThisThreadState()
was added as part of the PEP 311 implementation. However, it wasn't part of that proposal. It isn't clear that it was even meant to be public API.If a user wants to know what the current thread state is then they should use
PyThreadState_Get()
.PyGILState_GetThisThreadState()
is subtly different and surfaces some of the trickyPyGILState
corner cases thatPyThreadState_Get()
blissfully ignores. A real issue here is that users are reasonably likely to stumble acrossPyGILState_GetThisThreadState()
and, due to the name, use it instead of the proper API.I can think of one thing that
PyGILState_GetThisThreadState()
does exclusively: it will tell you what existing thread statePyGILState_Ensure()
will use, if any. It isn't clear to me if that's a meaningful use case.Ultimately, I expect we would be fine to get rid of
PyGILState_GetThisThreadState()
. If still useful for core development, it could be moved to the internal C-API.Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
The text was updated successfully, but these errors were encountered: