summaryrefslogtreecommitdiff
path: root/numpy/core
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/core')
-rw-r--r--numpy/core/src/multiarray/ctors.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/numpy/core/src/multiarray/ctors.c b/numpy/core/src/multiarray/ctors.c
index 3385fba7d..989370f8b 100644
--- a/numpy/core/src/multiarray/ctors.c
+++ b/numpy/core/src/multiarray/ctors.c
@@ -2786,7 +2786,7 @@ PyArray_ArangeObj(PyObject *start, PyObject *stop, PyObject *step, PyArray_Descr
/* calculate the length and next = start + step*/
length = _calc_length(start, stop, step, &next,
PyTypeNum_ISCOMPLEX(dtype->type_num));
- err = PyErr_Occurred();
+ err = PyErr_Occurred();
if (err) {
Py_DECREF(dtype);
if (err && PyErr_GivenExceptionMatches(err, PyExc_OverflowError)) {
@@ -3042,6 +3042,10 @@ PyArray_FromFile(FILE *fp, PyArray_Descr *dtype, intp num, char *sep)
(next_element) fromfile_next_element,
(skip_separator) fromfile_skip_separator, NULL);
}
+ if (ret == NULL) {
+ Py_DECREF(dtype);
+ return NULL;
+ }
if (((intp) nread) < num) {
/* Realloc memory for smaller number of elements */
const size_t nsize = NPY_MAX(nread,1)*ret->descr->elsize;