diff options
author | Christoph Gohlke <cgohlke@uci.edu> | 2021-02-23 20:08:28 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-23 20:08:28 -0800 |
commit | e97fba2e84ff2f2070c7abecbb8070a95df9f69b (patch) | |
tree | bcf80e2f1c261971adcff7c0755bc1a4f47bf4fc /numpy | |
parent | 10e43ca5882a22de3ef9082ffce82c65c3261b8f (diff) | |
download | numpy-e97fba2e84ff2f2070c7abecbb8070a95df9f69b.tar.gz |
BUG: check if PyArray_malloc succeeded
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/src/umath/ufunc_object.c | 6 |
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]); |