]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] gh-109700: fix memory error handling in `PyDict_SetDefault` (GH-136338) (...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 6 Jul 2025 15:43:16 +0000 (17:43 +0200)
committerGitHub <noreply@github.com>
Sun, 6 Jul 2025 15:43:16 +0000 (15:43 +0000)
gh-109700: fix memory error handling in `PyDict_SetDefault` (GH-136338)
(cherry picked from commit d22e073d2b49313bbf42d40cbe74afa2b69385df)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Misc/NEWS.d/next/Core_and_Builtins/2025-07-06-14-53-19.gh-issue-109700.KVNQQi.rst [new file with mode: 0644]
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 (file)
index 0000000..a37f4a5
--- /dev/null
@@ -0,0 +1 @@
+Fix memory error handling in :c:func:`PyDict_SetDefault`.
index 72901377cbb3da7bfe016b9d327dafa22fef54a2..b4940315a6c28d3c672b17dbd3dc7e6d909b7489 100644 (file)
@@ -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);