summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_ctypes/_ctypes.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index 9c81247..32d67b0 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -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));