mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #1545463: Global variables caught in reference cycles are now garbage-collected at shutdown.
This commit is contained in:
parent
1df37c657d
commit
5f454a07a0
6 changed files with 56 additions and 5 deletions
|
@ -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)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue