Skip to content

Commit cdc99ce

Browse files
committed
remove extra call to tstate_delete_common (merge artifact)
1 parent b86300f commit cdc99ce

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

Python/pystate.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff 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 */

0 commit comments

Comments
 (0)