From: Kumar Aditya Date: Sun, 6 Jul 2025 15:18:11 +0000 (+0530) Subject: gh-109700: fix memory error handling in `PyDict_SetDefault` (#136338) X-Git-Tag: v3.15.0a1~1081 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d22e073d2b49313bbf42d40cbe74afa2b69385df;p=thirdparty%2FPython%2Fcpython.git gh-109700: fix memory error handling in `PyDict_SetDefault` (#136338) --- 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 000000000000..a37f4a510509 --- /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 6b7b150f0e2f..be62ae5eefd0 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);