Skip to content

Commit 97a45b0

Browse files
miss-islingtonaiskblurb-it[bot]sobolevn
authored
[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 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 25a53d9 commit 97a45b0

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
@@ -1083,6 +1083,7 @@ _PyObjectArray_FromStackRefArray(_PyStackRef *input, Py_ssize_t nargs, PyObject
10831083
// +1 in case PY_VECTORCALL_ARGUMENTS_OFFSET is set.
10841084
result = PyMem_Malloc((nargs + 1) * sizeof(PyObject *));
10851085
if (result == NULL) {
1086+
PyErr_NoMemory();
10861087
return NULL;
10871088
}
10881089
result++;

0 commit comments

Comments
 (0)