Skip to content

Commit 7342e01

Browse files
miss-islingtonaiskblurb-it[bot]sobolevn
authored
[3.15] gh-153205: Set MemoryError in stackref array conversion (GH-153206) (#153272)
gh-153205: Set `MemoryError` in stackref array conversion (GH-153206) (cherry picked from commit 08759ff) 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>
1 parent 07d8f50 commit 7342e01

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
@@ -1057,6 +1057,7 @@ _PyObjectArray_FromStackRefArray(_PyStackRef *input, Py_ssize_t nargs, PyObject
10571057
// +1 in case PY_VECTORCALL_ARGUMENTS_OFFSET is set.
10581058
result = PyMem_Malloc((nargs + 1) * sizeof(PyObject *));
10591059
if (result == NULL) {
1060+
PyErr_NoMemory();
10601061
return NULL;
10611062
}
10621063
}

0 commit comments

Comments
 (0)