Skip to content

Commit 8cf9517

Browse files
gh-151126: Set MemoryError on alloc failure in _PyXIData_InitWithSize
1 parent 43a1869 commit 8cf9517

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+
Raise :exc:`MemoryError` on allocation failure in
2+
``_PyXIData_InitWithSize``.

Python/crossinterp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ _PyXIData_InitWithSize(_PyXIData_t *xidata,
388388
_PyXIData_Init(xidata, interp, NULL, obj, new_object);
389389
xidata->data = PyMem_RawCalloc(1, size);
390390
if (xidata->data == NULL) {
391+
PyErr_NoMemory();
391392
return -1;
392393
}
393394
xidata->free = PyMem_RawFree;

0 commit comments

Comments
 (0)