Skip to content

Commit 78a37d5

Browse files
ZeroIntensityhyongtao-codeblurb-it[bot]
authored
[3.13] gh-144307: Fix a reference leak during module teardown (GH-144308) (GH-144328)
(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 a75c58b commit 78a37d5

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
@@ -1609,6 +1609,7 @@ finalize_remove_modules(PyObject *modules, int verbose)
16091609
PyObject *value = PyObject_GetItem(modules, key);
16101610
if (value == NULL) {
16111611
PyErr_FormatUnraisable("Exception ignored on removing modules");
1612+
Py_DECREF(key);
16121613
continue;
16131614
}
16141615
CLEAR_MODULE(key, value);

0 commit comments

Comments
 (0)