@@ -338,7 +338,7 @@ PyThreadState_Delete(PyThreadState *tstate)
338338 Py_FatalError ("PyThreadState_Delete: tstate is still current" );
339339 tstate_delete_common (tstate );
340340#ifdef WITH_THREAD
341- if (autoTLSkey && PyThread_get_key_value (autoTLSkey ) == tstate )
341+ if (autoInterpreterState && PyThread_get_key_value (autoTLSkey ) == tstate )
342342 PyThread_delete_key_value (autoTLSkey );
343343#endif /* WITH_THREAD */
344344}
@@ -354,7 +354,7 @@ PyThreadState_DeleteCurrent()
354354 "PyThreadState_DeleteCurrent: no current tstate" );
355355 _PyThreadState_Current = NULL ;
356356 tstate_delete_common (tstate );
357- if (autoTLSkey && PyThread_get_key_value (autoTLSkey ) == tstate )
357+ if (autoInterpreterState && PyThread_get_key_value (autoTLSkey ) == tstate )
358358 PyThread_delete_key_value (autoTLSkey );
359359 PyEval_ReleaseLock ();
360360}
574574_PyGILState_Fini (void )
575575{
576576 PyThread_delete_key (autoTLSkey );
577- autoTLSkey = 0 ;
578577 autoInterpreterState = NULL ;
579578}
580579
@@ -586,10 +585,10 @@ _PyGILState_Fini(void)
586585static void
587586_PyGILState_NoteThreadState (PyThreadState * tstate )
588587{
589- /* If autoTLSkey is 0 , this must be the very first threadstate created
590- in Py_Initialize(). Don't do anything for now (we'll be back here
591- when _PyGILState_Init is called). */
592- if (!autoTLSkey )
588+ /* If autoTLSkey isn't initialized , this must be the very first
589+ threadstate created in Py_Initialize(). Don't do anything for now
590+ (we'll be back here when _PyGILState_Init is called). */
591+ if (!autoInterpreterState )
593592 return ;
594593
595594 /* Stick the thread state for this thread in thread local storage.
@@ -617,7 +616,7 @@ _PyGILState_NoteThreadState(PyThreadState* tstate)
617616PyThreadState *
618617PyGILState_GetThisThreadState (void )
619618{
620- if (autoInterpreterState == NULL || autoTLSkey == 0 )
619+ if (autoInterpreterState == NULL )
621620 return NULL ;
622621 return (PyThreadState * )PyThread_get_key_value (autoTLSkey );
623622}
0 commit comments