diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2013-05-06 19:15:57 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2013-05-06 19:15:57 (GMT) |
commit | 5f454a07a054eb0db7499d8dbd537ff8ce7bda18 (patch) | |
tree | 08557fde41d4a25d1961b38face3ca46bb8c695d /Python/import.c | |
parent | 1df37c657d7b32cfc7e765f13323415ef1c5be31 (diff) | |
download | cpython-5f454a07a054eb0db7499d8dbd537ff8ce7bda18.zip cpython-5f454a07a054eb0db7499d8dbd537ff8ce7bda18.tar.gz cpython-5f454a07a054eb0db7499d8dbd537ff8ce7bda18.tar.bz2 |
Issue #1545463: Global variables caught in reference cycles are now garbage-collected at shutdown.
Diffstat (limited to 'Python/import.c')
-rw-r--r-- | Python/import.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Python/import.c b/Python/import.c index b77eda1..cd4fb78 100644 --- a/Python/import.c +++ b/Python/import.c @@ -403,6 +403,14 @@ PyImport_Cleanup(void) } } + /* 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)) { |