Skip to content

Commit 6cb9029

Browse files
committed
PyGILState cleanup was too early - destructors called via module cleanup may use the API.
1 parent ecd2fdc commit 6cb9029

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎Python/pythonrun.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -254,11 +254,6 @@ Py_Finalize(void)
254254
call_sys_exitfunc();
255255
initialized = 0;
256256

257-
/* Cleanup auto-thread-state */
258-
#ifdef WITH_THREAD
259-
_PyGILState_Fini();
260-
#endif /* WITH_THREAD */
261-
262257
/* Get current thread state and interpreter pointer */
263258
tstate = PyThreadState_Get();
264259
interp = tstate->interp;
@@ -310,6 +305,11 @@ Py_Finalize(void)
310305
*/
311306
_PyExc_Fini();
312307

308+
/* Cleanup auto-thread-state */
309+
#ifdef WITH_THREAD
310+
_PyGILState_Fini();
311+
#endif /* WITH_THREAD */
312+
313313
/* Clear interpreter state */
314314
PyInterpreterState_Clear(interp);
315315

0 commit comments

Comments
 (0)