gh-120838: Add _PyThreadState_WHENCE_FINI (gh-121010)
We also add _PyThreadState_NewBound() and drop _PyThreadState_SetWhence(). This change only affects internal API.
This commit is contained in:
@@ -1293,9 +1293,8 @@ _PyInterpreterState_IDDecref(PyInterpreterState *interp)
|
||||
PyThread_release_lock(interp->id_mutex);
|
||||
|
||||
if (refcount == 0 && interp->requires_idref) {
|
||||
PyThreadState *tstate = _PyThreadState_New(interp,
|
||||
_PyThreadState_WHENCE_INTERP);
|
||||
_PyThreadState_Bind(tstate);
|
||||
PyThreadState *tstate =
|
||||
_PyThreadState_NewBound(interp, _PyThreadState_WHENCE_FINI);
|
||||
|
||||
// XXX Possible GILState issues?
|
||||
PyThreadState *save_tstate = _PyThreadState_Swap(runtime, tstate);
|
||||
@@ -1603,8 +1602,13 @@ new_threadstate(PyInterpreterState *interp, int whence)
|
||||
PyThreadState *
|
||||
PyThreadState_New(PyInterpreterState *interp)
|
||||
{
|
||||
PyThreadState *tstate = new_threadstate(interp,
|
||||
_PyThreadState_WHENCE_UNKNOWN);
|
||||
return _PyThreadState_NewBound(interp, _PyThreadState_WHENCE_UNKNOWN);
|
||||
}
|
||||
|
||||
PyThreadState *
|
||||
_PyThreadState_NewBound(PyInterpreterState *interp, int whence)
|
||||
{
|
||||
PyThreadState *tstate = new_threadstate(interp, whence);
|
||||
if (tstate) {
|
||||
bind_tstate(tstate);
|
||||
// This makes sure there's a gilstate tstate bound
|
||||
|
||||
Reference in New Issue
Block a user