https://github.com/python/cpython/commit/97a45b0d000ec9e13291bf70dd59c3b8d68fde80
commit: 97a45b0d000ec9e13291bf70dd59c3b8d68fde80
branch: 3.14
author: Miss Islington (bot) <[email protected]>
committer: sobolevn <[email protected]>
date: 2026-07-07T16:32:27Z
summary:

[3.14] gh-153205: Set `MemoryError` in stackref array conversion (GH-153206) 
(#153273)

gh-153205: Set `MemoryError` in stackref array conversion (GH-153206)
(cherry picked from commit 08759ff1015552d58c1f6ffa13ea08b0ae32e6c0)

Co-authored-by: An Long <[email protected]>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: sobolevn <[email protected]>

files:
A 
Misc/NEWS.d/next/Core_and_Builtins/2026-07-07-04-16-48.gh-issue-153205.5fE8QZ.rst
M 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
index 00000000000000..9ccfbff7ee6977
--- /dev/null
+++ 
b/Misc/NEWS.d/next/Core_and_Builtins/2026-07-07-04-16-48.gh-issue-153205.5fE8QZ.rst
@@ -0,0 +1,2 @@
+Fix a potential :exc:`SystemError` during vector calls when memory allocation 
fails.
+A :exc:`MemoryError` is now raised instead.
diff --git a/Python/ceval.c b/Python/ceval.c
index b4fded923c10d3..b3dab2e9da5a71 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -1083,6 +1083,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;
         }
         result++;

_______________________________________________
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