@@ -340,7 +340,7 @@ PyThreadState_Delete(PyThreadState *tstate)
340340 Py_FatalError ("PyThreadState_Delete: tstate is still current" );
341341 tstate_delete_common (tstate );
342342#ifdef WITH_THREAD
343- if (autoTLSkey && PyThread_get_key_value (autoTLSkey ) == tstate )
343+ if (autoInterpreterState && PyThread_get_key_value (autoTLSkey ) == tstate )
344344 PyThread_delete_key_value (autoTLSkey );
345345#endif /* WITH_THREAD */
346346}
@@ -357,7 +357,7 @@ PyThreadState_DeleteCurrent()
357357 "PyThreadState_DeleteCurrent: no current tstate" );
358358 _Py_atomic_store_relaxed (& _PyThreadState_Current , NULL );
359359 tstate_delete_common (tstate );
360- if (autoTLSkey && PyThread_get_key_value (autoTLSkey ) == tstate )
360+ if (autoInterpreterState && PyThread_get_key_value (autoTLSkey ) == tstate )
361361 PyThread_delete_key_value (autoTLSkey );
362362 PyEval_ReleaseLock ();
363363}
580580_PyGILState_Fini (void )
581581{
582582 PyThread_delete_key (autoTLSkey );
583- autoTLSkey = 0 ;
584583 autoInterpreterState = NULL ;
585584}
586585
@@ -592,10 +591,10 @@ _PyGILState_Fini(void)
592591static void
593592_PyGILState_NoteThreadState (PyThreadState * tstate )
594593{
595- /* If autoTLSkey is 0 , this must be the very first threadstate created
596- in Py_Initialize(). Don't do anything for now (we'll be back here
597- when _PyGILState_Init is called). */
598- if (!autoTLSkey )
594+ /* If autoTLSkey isn't initialized , this must be the very first
595+ threadstate created in Py_Initialize(). Don't do anything for now
596+ (we'll be back here when _PyGILState_Init is called). */
597+ if (!autoInterpreterState )
599598 return ;
600599
601600 /* Stick the thread state for this thread in thread local storage.
@@ -623,7 +622,7 @@ _PyGILState_NoteThreadState(PyThreadState* tstate)
623622PyThreadState *
624623PyGILState_GetThisThreadState (void )
625624{
626- if (autoInterpreterState == NULL || autoTLSkey == 0 )
625+ if (autoInterpreterState == NULL )
627626 return NULL ;
628627 return (PyThreadState * )PyThread_get_key_value (autoTLSkey );
629628}
0 commit comments