summaryrefslogtreecommitdiffstats
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-12-08 23:43:45 (GMT)
committerGuido van Rossum <guido@python.org>1997-12-08 23:43:45 (GMT)
commit1707aad27c36024d8ee00bd59ee223d16a9bb6d1 (patch)
tree17bd45db8eec92b40a9679c4db515662cf7edb01 /Python/pythonrun.c
parentbe1eb0d9edc4720d97b2f5eac085d77b6dd34346 (diff)
downloadcpython-1707aad27c36024d8ee00bd59ee223d16a9bb6d1.zip
cpython-1707aad27c36024d8ee00bd59ee223d16a9bb6d1.tar.gz
cpython-1707aad27c36024d8ee00bd59ee223d16a9bb6d1.tar.bz2
Changed the finalization order again so that the reference count
printing (when Py_DEBUG is defined) happens while there's still a current thread...
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r--Python/pythonrun.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index b8abe25..e574281 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -198,13 +198,29 @@ Py_Finalize()
/* Destroy all modules */
PyImport_Cleanup();
+ /* Destroy the database used by _PyImport_{Fixup,Find}Extension */
+ _PyImport_Fini();
+
+ /* Debugging stuff */
+#ifdef COUNT_ALLOCS
+ dump_counts();
+#endif
+
+#ifdef Py_REF_DEBUG
+ fprintf(stderr, "[%ld refs]\n", _Py_RefTotal);
+#endif
+
+#ifdef Py_TRACE_REFS
+ if (_Py_AskYesNo("Print left references?")) {
+ _Py_PrintReferences(stderr);
+ }
+#endif /* Py_TRACE_REFS */
+
/* Delete current thread */
PyInterpreterState_Clear(interp);
PyThreadState_Swap(NULL);
PyInterpreterState_Delete(interp);
- _PyImport_Fini();
-
/* Now we decref the exception classes. After this point nothing
can raise an exception. That's okay, because each Fini() method
below has been checked to make sure no exceptions are ever
@@ -229,18 +245,7 @@ Py_Finalize()
call_ll_exitfuncs();
-#ifdef COUNT_ALLOCS
- dump_counts();
-#endif
-
-#ifdef Py_REF_DEBUG
- fprintf(stderr, "[%ld refs]\n", _Py_RefTotal);
-#endif
-
#ifdef Py_TRACE_REFS
- if (_Py_AskYesNo("Print left references?")) {
- _Py_PrintReferences(stderr);
- }
_Py_ResetReferences();
#endif /* Py_TRACE_REFS */
}