diff Python/import.c @ 83650:f0833e6ff2d2

Issue #1545463: Global variables caught in reference cycles are now garbage-collected at shutdown.
author Antoine Pitrou <solipsis@pitrou.net>
date Mon, 06 May 2013 21:15:57 +0200
parents 8a364deb0225
children 8a5bebea9fec
line wrap: on
line diff
--- a/Python/import.c	Mon May 06 14:51:13 2013 -0400
+++ b/Python/import.c	Mon May 06 21:15:57 2013 +0200
@@ -403,6 +403,14 @@
         }
     }
 
+    /* Collect garbage remaining after deleting the modules. Mostly
+       reference cycles created by classes. */
+    PyGC_Collect();
+
+    /* Dump GC stats before it's too late, since it uses the warnings
+       machinery. */
+    _PyGC_DumpShutdownStats();
+
     /* Next, delete sys and builtins (in that order) */
     value = PyDict_GetItemString(modules, "sys");
     if (value != NULL && PyModule_Check(value)) {