]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.15] gh-153205: Set `MemoryError` in stackref array conversion (GH-153206) (#153272)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 7 Jul 2026 16:34:17 +0000 (18:34 +0200)
committerGitHub <noreply@github.com>
Tue, 7 Jul 2026 16:34:17 +0000 (16:34 +0000)
gh-153205: Set `MemoryError` in stackref array conversion (GH-153206)
(cherry picked from commit 08759ff1015552d58c1f6ffa13ea08b0ae32e6c0)

Co-authored-by: An Long <aisk@users.noreply.github.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
Misc/NEWS.d/next/Core_and_Builtins/2026-07-07-04-16-48.gh-issue-153205.5fE8QZ.rst [new file with mode: 0644]
Python/ceval.c

diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2026-07-07-04-16-48.gh-issue-153205.5fE8QZ.rst b/Misc/NEWS.d/next/Core_and_Builtins/2026-07-07-04-16-48.gh-issue-153205.5fE8QZ.rst
new file mode 100644 (file)
index 0000000..9ccfbff
--- /dev/null
@@ -0,0 +1,2 @@
+Fix a potential :exc:`SystemError` during vector calls when memory allocation fails.
+A :exc:`MemoryError` is now raised instead.
index 464a00860524fcc7cc5e2738518ea39a850d22f0..0827b87e00790f043c37e3541bc8096ac7605e51 100644 (file)
@@ -1057,6 +1057,7 @@ _PyObjectArray_FromStackRefArray(_PyStackRef *input, Py_ssize_t nargs, PyObject
         // +1 in case PY_VECTORCALL_ARGUMENTS_OFFSET is set.
         result = PyMem_Malloc((nargs + 1) * sizeof(PyObject *));
         if (result == NULL) {
+            PyErr_NoMemory();
             return NULL;
         }
     }