https://github.com/python/cpython/commit/49ce23f2d706401526d54be7f28136e4b5104cbb commit: 49ce23f2d706401526d54be7f28136e4b5104cbb branch: 3.14 author: Miss Islington (bot) <[email protected]> committer: ZeroIntensity <[email protected]> date: 2026-01-29T19:19:14Z summary:
[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 219b7ac9d562701bbde21d7e17845c4942b83338) Signed-off-by: Yongtao Huang <[email protected]> Co-authored-by: Yongtao Huang <[email protected]> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> files: A Misc/NEWS.d/next/Core_and_Builtins/2026-01-29-02-18-08.gh-issue-144307.CLbm_o.rst M Python/pylifecycle.c diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2026-01-29-02-18-08.gh-issue-144307.CLbm_o.rst b/Misc/NEWS.d/next/Core_and_Builtins/2026-01-29-02-18-08.gh-issue-144307.CLbm_o.rst new file mode 100644 index 00000000000000..d6928e643dccd3 --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2026-01-29-02-18-08.gh-issue-144307.CLbm_o.rst @@ -0,0 +1 @@ +Prevent a reference leak in module teardown at interpreter finalization. diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 9ae5e06702370e..6963635213a090 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -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); _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
