mirror of
https://github.com/python/cpython.git
synced 2026-01-06 23:42:34 +00:00
Issue #19437: Fix PyCArrayType constructor, raise MemoryError on PyMem_Malloc()
failure
This commit is contained in:
parent
ba9be477b0
commit
a215002453
1 changed files with 3 additions and 1 deletions
|
|
@ -1309,8 +1309,10 @@ PyCArrayType_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
goto error;
|
||||
stgdict->ndim = itemdict->ndim + 1;
|
||||
stgdict->shape = PyMem_Malloc(sizeof(Py_ssize_t) * stgdict->ndim);
|
||||
if (stgdict->shape == NULL)
|
||||
if (stgdict->shape == NULL) {
|
||||
PyErr_NoMemory();
|
||||
goto error;
|
||||
}
|
||||
stgdict->shape[0] = length;
|
||||
memmove(&stgdict->shape[1], itemdict->shape,
|
||||
sizeof(Py_ssize_t) * (stgdict->ndim - 1));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue