mirror of
https://github.com/python/cpython.git
synced 2025-07-28 05:34:31 +00:00
Issue #1402: PyInterpreterState_Clear() may still invoke user code
(in deallocation of running threads, for example), so the PyGILState_Release() function must still be functional. On the other hand, _PyGILState_Fini() only frees memory, and can be called later. Backport candidate, but only after some experts comment on it.
This commit is contained in:
parent
82225b7737
commit
025c347d61
2 changed files with 39 additions and 5 deletions
|
@ -437,11 +437,6 @@ Py_Finalize(void)
|
|||
_Py_PrintReferences(stderr);
|
||||
#endif /* Py_TRACE_REFS */
|
||||
|
||||
/* Cleanup auto-thread-state */
|
||||
#ifdef WITH_THREAD
|
||||
_PyGILState_Fini();
|
||||
#endif /* WITH_THREAD */
|
||||
|
||||
/* Clear interpreter state */
|
||||
PyInterpreterState_Clear(interp);
|
||||
|
||||
|
@ -453,6 +448,11 @@ Py_Finalize(void)
|
|||
|
||||
_PyExc_Fini();
|
||||
|
||||
/* Cleanup auto-thread-state */
|
||||
#ifdef WITH_THREAD
|
||||
_PyGILState_Fini();
|
||||
#endif /* WITH_THREAD */
|
||||
|
||||
/* Delete current thread */
|
||||
PyThreadState_Swap(NULL);
|
||||
PyInterpreterState_Delete(interp);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue