File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -423,6 +423,8 @@ PyThreadState_DeleteCurrent()
423423 Py_FatalError (
424424 "PyThreadState_DeleteCurrent: no current tstate" );
425425 _Py_atomic_store_relaxed (& _PyThreadState_Current , NULL );
426+ if (autoInterpreterState && PyThread_get_key_value (autoTLSkey ) == tstate )
427+ PyThread_delete_key_value (autoTLSkey );
426428 /*
427429 Only call tstate_delete_common to have the tstate if we're not finalizing
428430 or we're the main thread. The main thread will do this for us. Not calling
@@ -431,9 +433,6 @@ PyThreadState_DeleteCurrent()
431433 */
432434 if (!_Py_Finalizing || _Py_Finalizing == tstate )
433435 tstate_delete_common (tstate );
434- if (autoInterpreterState && PyThread_get_key_value (autoTLSkey ) == tstate )
435- PyThread_delete_key_value (autoTLSkey );
436- tstate_delete_common (tstate );
437436 PyEval_ReleaseLock ();
438437}
439438#endif /* WITH_THREAD */
You can’t perform that action at this time.
0 commit comments