https://github.com/python/cpython/commit/5b65df7925d0d6c9c837661a5a0348dda4a88ba6
commit: 5b65df7925d0d6c9c837661a5a0348dda4a88ba6
branch: 3.14
author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com>
committer: kumaraditya303 <kumaradi...@python.org>
date: 2025-07-06T15:43:16Z
summary:

[3.14] gh-109700: fix memory error handling in `PyDict_SetDefault` (GH-136338) 
(#136340)

gh-109700: fix memory error handling in `PyDict_SetDefault` (GH-136338)
(cherry picked from commit d22e073d2b49313bbf42d40cbe74afa2b69385df)

Co-authored-by: Kumar Aditya <kumaradi...@python.org>

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 72901377cbb3da..b4940315a6c28d 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -4411,6 +4411,7 @@ dict_setdefault_ref_lock_held(PyObject *d, PyObject *key, 
PyObject *default_valu
             if (result) {
                 *result = NULL;
             }
+            return -1;
         }
 
         STORE_USED(mp, mp->ma_used + 1);

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: arch...@mail-archive.com

Reply via email to