Mercurial > cpython-lru_cache-weakref
diff Python/pythonrun.c @ 44063:4417ab5b351e legacy-trunk
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.
| author | Amaury Forgeot d'Arc <amauryfa@gmail.com> |
|---|---|
| date | Thu, 29 Nov 2007 23:35:25 +0000 |
| parents | 708c8c5fc173 |
| children | 599f22a349a2 |
line wrap: on
line diff
--- a/Python/pythonrun.c Thu Nov 29 23:00:03 2007 +0000 +++ b/Python/pythonrun.c Thu Nov 29 23:35:25 2007 +0000 @@ -437,11 +437,6 @@ _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 @@ _PyExc_Fini(); + /* Cleanup auto-thread-state */ +#ifdef WITH_THREAD + _PyGILState_Fini(); +#endif /* WITH_THREAD */ + /* Delete current thread */ PyThreadState_Swap(NULL); PyInterpreterState_Delete(interp);
