diff Python/pythonrun.c @ 28651:7fda09f751ad legacy-trunk

- New C API PyGC_Collect(), same as calling gc.collect(). - Call this in Py_Finalize(). - Expand the Misc/NEWS text on PY_LONG_LONG.
author Guido van Rossum <guido@python.org>
date Thu, 17 Apr 2003 17:29:22 +0000
parents 04b172843292
children 56006d97bcef
line wrap: on
line diff
--- a/Python/pythonrun.c	Thu Apr 17 16:53:26 2003 +0000
+++ b/Python/pythonrun.c	Thu Apr 17 17:29:22 2003 +0000
@@ -255,9 +255,17 @@
 	Py_XDECREF(PyModule_WarningsModule);
 	PyModule_WarningsModule = NULL;
 
+	/* Collect garbage.  This may call finalizers; it's nice to call these
+	   before all modules are destroyed. */
+	PyGC_Collect();
+
 	/* Destroy all modules */
 	PyImport_Cleanup();
 
+	/* Collect final garbage.  This disposes of cycles created by
+	   new-style class definitions, for example. */
+	PyGC_Collect();
+
 	/* Destroy the database used by _PyImport_{Fixup,Find}Extension */
 	_PyImport_Fini();