https://github.com/python/cpython/commit/aced381f5058206eb09ff7f48b44998cd4e8efcc
commit: aced381f5058206eb09ff7f48b44998cd4e8efcc
branch: main
author: Victor Stinner <[email protected]>
committer: vstinner <[email protected]>
date: 2026-11-19T00:55:19Z
summary:
gh-161767: Fix refleak in PyDict_AsFrozenDictAndClear() (#162250)
Py_DECREF() the frozendict if transfer_keys_and_values_lock_held()
fails.
files:
M Objects/dictobject.c
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index ed8b53b8a08d49..4a1d1b069a21ed 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -8717,6 +8717,7 @@ PyDict_AsFrozenDictAndClear(PyObject *dict)
transfer = transfer_keys_and_values_lock_held(res, dict);
Py_END_CRITICAL_SECTION();
if (transfer < 0) {
+ Py_DECREF(res);
return NULL;
}
_______________________________________________
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]