diff Python/pythonrun.c @ 6786:bc007cf1d6ba legacy-trunk

Changed the finalization order again so that the reference count printing (when Py_DEBUG is defined) happens while there's still a current thread...
author Guido van Rossum <guido@python.org>
date Mon, 08 Dec 1997 23:43:45 +0000
parents 99955b65408d
children f5f305d7a617
line wrap: on
line diff
--- a/Python/pythonrun.c	Mon Dec 08 21:56:43 1997 +0000
+++ b/Python/pythonrun.c	Mon Dec 08 23:43:45 1997 +0000
@@ -198,13 +198,29 @@
 	/* 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 @@
 
 	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 */
 }