summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorChristoph Gohlke <cgohlke@uci.edu>2021-02-23 20:08:28 -0800
committerGitHub <noreply@github.com>2021-02-23 20:08:28 -0800
commite97fba2e84ff2f2070c7abecbb8070a95df9f69b (patch)
treebcf80e2f1c261971adcff7c0755bc1a4f47bf4fc /numpy
parent10e43ca5882a22de3ef9082ffce82c65c3261b8f (diff)
downloadnumpy-e97fba2e84ff2f2070c7abecbb8070a95df9f69b.tar.gz
BUG: check if PyArray_malloc succeeded
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/src/umath/ufunc_object.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/numpy/core/src/umath/ufunc_object.c b/numpy/core/src/umath/ufunc_object.c
index cd6e27a35..269b2e81a 100644
--- a/numpy/core/src/umath/ufunc_object.c
+++ b/numpy/core/src/umath/ufunc_object.c
@@ -5219,7 +5219,11 @@ PyUFunc_RegisterLoopForDescr(PyUFuncObject *ufunc,
if (cmp == 0 && current != NULL && current->arg_dtypes == NULL) {
current->arg_dtypes = PyArray_malloc(ufunc->nargs *
sizeof(PyArray_Descr*));
- if (arg_dtypes != NULL) {
+ if (current->arg_dtypes == NULL) {
+ PyErr_NoMemory();
+ result = -1;
+ }
+ else if (arg_dtypes != NULL) {
for (i = 0; i < ufunc->nargs; i++) {
current->arg_dtypes[i] = arg_dtypes[i];
Py_INCREF(current->arg_dtypes[i]);