summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/pylifecycle.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index eb065eb..e218808 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -1303,6 +1303,13 @@ finalize_interp_clear(PyThreadState *tstate)
finalize_interp_types(tstate, is_main_interp);
+ /* Clear all loghooks */
+ /* Both _PySys_Audit function and users still need PyObject, such as tuple.
+ Call _PySys_ClearAuditHooks when PyObject available. */
+ if (is_main_interp) {
+ _PySys_ClearAuditHooks(tstate);
+ }
+
if (is_main_interp) {
/* XXX Still allocated:
- various static ad-hoc pointers to interned strings
@@ -1419,9 +1426,6 @@ Py_FinalizeEx(void)
*/
_PyGC_CollectIfEnabled();
- /* Clear all loghooks */
- _PySys_ClearAuditHooks(tstate);
-
/* Destroy all modules */
_PyImport_Cleanup(tstate);