Skip to content

Commit 08759ff

Browse files
aiskblurb-it[bot]sobolevn
authored
gh-153205: Set MemoryError in stackref array conversion (#153206)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: sobolevn <mail@sobolevn.me>
1 parent fd9d8c3 commit 08759ff

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix a potential :exc:`SystemError` during vector calls when memory allocation fails.
2+
A :exc:`MemoryError` is now raised instead.

Python/ceval.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,6 +1056,7 @@ _PyObjectArray_FromStackRefArray(_PyStackRef *input, Py_ssize_t nargs, PyObject
10561056
// +1 in case PY_VECTORCALL_ARGUMENTS_OFFSET is set.
10571057
result = PyMem_Malloc((nargs + 1) * sizeof(PyObject *));
10581058
if (result == NULL) {
1059+
PyErr_NoMemory();
10591060
return NULL;
10601061
}
10611062
}

0 commit comments

Comments
 (0)