Migrate from PyGILState_Check
to thread state checks internally
#128360
Labels
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
topic-subinterpreters
type-feature
A feature request or enhancement
Feature or enhancement
Proposal:
In some older areas of the codebase, we have the following to ensure that the caller holds the GIL (or really, an attached thread state):
This doesn't work for subinterpreters, because GILstate checks are disabled when subinterpreters exist. This hasn't been an issue in practice, but it would be nice to get these replaced with more correct thread state checks. I think a helper function that calls
_Py_EnsureTstateNotNULL
if assertions are enabled would work nicely.Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs
The text was updated successfully, but these errors were encountered: