This moves `current_fast_clear()` up so that the current thread state is
`NULL` while running `tstate_delete_common()`.
This doesn't fix any bugs, but it means that we are more consistent that
`_PyThreadState_GET() != NULL` means that the thread is "attached".
{
assert(tstate->_status.cleared && !tstate->_status.finalized);
assert(tstate->state != _Py_THREAD_ATTACHED);
+ tstate_verify_not_active(tstate);
PyInterpreterState *interp = tstate->interp;
if (interp == NULL) {
_Py_qsbr_detach(((_PyThreadStateImpl *)tstate)->qsbr);
#endif
tstate_set_detached(tstate, _Py_THREAD_DETACHED);
- tstate_delete_common(tstate);
current_fast_clear(tstate->interp->runtime);
+ tstate_delete_common(tstate);
_PyEval_ReleaseLock(tstate->interp, NULL);
free_threadstate((_PyThreadStateImpl *)tstate);
}