summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-10-30 16:00:00 (GMT)
committerGitHub <noreply@github.com>2020-10-30 16:00:00 (GMT)
commit8b3414818f5289eac530bf38bcfbd7b2b851805c (patch)
tree7ca16e738927f6dd4be87aed29ae3a06817f9c3b /Python
parent99608c733c5960f7834adca933c02f6ddf9b1df9 (diff)
downloadcpython-8b3414818f5289eac530bf38bcfbd7b2b851805c.zip
cpython-8b3414818f5289eac530bf38bcfbd7b2b851805c.tar.gz
cpython-8b3414818f5289eac530bf38bcfbd7b2b851805c.tar.bz2
bpo-42208: Pass tstate to _PyGC_CollectNoFail() (GH-23038)
Move private _PyGC_CollectNoFail() to the internal C API. Remove the private _PyGC_CollectIfEnabled() which was just an alias to the public PyGC_Collect() function since Python 3.8. Rename functions: * collect() => gc_collect_main() * collect_with_callback() => gc_collect_with_callback() * collect_generations() => gc_collect_generations()
Diffstat (limited to 'Python')
-rw-r--r--Python/import.c4
-rw-r--r--Python/pylifecycle.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/Python/import.c b/Python/import.c
index b79bda0..8b9cc30 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -566,7 +566,7 @@ _PyImport_Cleanup(PyThreadState *tstate)
}
Py_XDECREF(dict);
/* Collect references */
- _PyGC_CollectNoFail();
+ _PyGC_CollectNoFail(tstate);
/* Dump GC stats before it's too late, since it uses the warnings
machinery. */
_PyGC_DumpShutdownStats(tstate);
@@ -626,7 +626,7 @@ _PyImport_Cleanup(PyThreadState *tstate)
Py_DECREF(modules);
/* Once more */
- _PyGC_CollectNoFail();
+ _PyGC_CollectNoFail(tstate);
#undef CLEAR_MODULE
#undef STORE_MODULE_WEAKREF
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 774a4f9..71834f6 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -1293,7 +1293,7 @@ finalize_interp_clear(PyThreadState *tstate)
PyInterpreterState_Clear(tstate->interp);
/* Last explicit GC collection */
- _PyGC_CollectNoFail();
+ _PyGC_CollectNoFail(tstate);
/* Clear all loghooks */
/* Both _PySys_Audit function and users still need PyObject, such as tuple.
@@ -1414,7 +1414,7 @@ Py_FinalizeEx(void)
* XXX but I'm unclear on exactly how that one happens. In any case,
* XXX I haven't seen a real-life report of either of these.
*/
- _PyGC_CollectIfEnabled();
+ PyGC_Collect();
/* Destroy all modules */
_PyImport_Cleanup(tstate);