Skip to content

Commit 49ce23f

Browse files
miss-islingtonhyongtao-codeblurb-it[bot]
authored
[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 219b7ac) 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>
1 parent de1b2cc commit 49ce23f

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Prevent a reference leak in module teardown at interpreter finalization.

Python/pylifecycle.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,6 +1601,7 @@ finalize_remove_modules(PyObject *modules, int verbose)
16011601
PyObject *value = PyObject_GetItem(modules, key);
16021602
if (value == NULL) {
16031603
PyErr_FormatUnraisable("Exception ignored while removing modules");
1604+
Py_DECREF(key);
16041605
continue;
16051606
}
16061607
CLEAR_MODULE(key, value);

0 commit comments

Comments
 (0)