Skip to content

Commit 219b7ac

Browse files
gh-144307: Fix a reference leak during module teardown (GH-144308)
Signed-off-by: Yongtao Huang <yongtaoh2022@gamil.com> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
1 parent 14c5339 commit 219b7ac

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
@@ -1622,6 +1622,7 @@ finalize_remove_modules(PyObject *modules, int verbose)
16221622
PyObject *value = PyObject_GetItem(modules, key);
16231623
if (value == NULL) {
16241624
PyErr_FormatUnraisable("Exception ignored while removing modules");
1625+
Py_DECREF(key);
16251626
continue;
16261627
}
16271628
CLEAR_MODULE(key, value);

0 commit comments

Comments
 (0)