mirror of
https://github.com/python/cpython.git
synced 2026-05-06 12:49:07 -04:00
[3.14] gh-144307: Fix a reference leak during module teardown (GH-144308) (GH-144327)
gh-144307: Fix a reference leak during module teardown (GH-144308)
(cherry picked from commit 219b7ac9d5)
Signed-off-by: Yongtao Huang <yongtaoh2022@gamil.com>
Co-authored-by: Yongtao Huang <yongtaoh2022@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
de1b2cce30
commit
49ce23f2d7
@@ -0,0 +1 @@
|
||||
Prevent a reference leak in module teardown at interpreter finalization.
|
||||
@@ -1601,6 +1601,7 @@ finalize_remove_modules(PyObject *modules, int verbose)
|
||||
PyObject *value = PyObject_GetItem(modules, key);
|
||||
if (value == NULL) {
|
||||
PyErr_FormatUnraisable("Exception ignored while removing modules");
|
||||
Py_DECREF(key);
|
||||
continue;
|
||||
}
|
||||
CLEAR_MODULE(key, value);
|
||||
|
||||
Reference in New Issue
Block a user