https://github.com/python/cpython/commit/823bf76d376f4bbd33876e08ecfba56984170a6d
commit: 823bf76d376f4bbd33876e08ecfba56984170a6d
branch: 3.13
author: Kumar Aditya <[email protected]>
committer: kumaraditya303 <[email protected]>
date: 2025-07-14T08:25:31Z
summary:

[3.13] gh-109700: fix memory error handling in `PyDict_SetDefault` (#136338) 
(#136642)

gh-109700: fix memory error handling in `PyDict_SetDefault` (#136338)

(cherry picked from commit d22e073d2b49313bbf42d40cbe74afa2b69385df)

files:
A Misc/NEWS.d/next/Core and 
Builtins/2025-07-06-14-53-19.gh-issue-109700.KVNQQi.rst
M Objects/dictobject.c

diff --git a/Misc/NEWS.d/next/Core and 
Builtins/2025-07-06-14-53-19.gh-issue-109700.KVNQQi.rst b/Misc/NEWS.d/next/Core 
and Builtins/2025-07-06-14-53-19.gh-issue-109700.KVNQQi.rst
new file mode 100644
index 00000000000000..a37f4a51050947
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and 
Builtins/2025-07-06-14-53-19.gh-issue-109700.KVNQQi.rst 
@@ -0,0 +1 @@
+Fix memory error handling in :c:func:`PyDict_SetDefault`.
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index baac54911f0371..69a69e13faefe6 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -4340,6 +4340,7 @@ dict_setdefault_ref_lock_held(PyObject *d, PyObject *key, 
PyObject *default_valu
             if (result) {
                 *result = NULL;
             }
+            return -1;
         }
 
         MAINTAIN_TRACKING(mp, 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]

Reply via email to