diff options
Diffstat (limited to 'scipy/base/src/arrayobject.c')
-rw-r--r-- | scipy/base/src/arrayobject.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/scipy/base/src/arrayobject.c b/scipy/base/src/arrayobject.c index edb875439..368c04f62 100644 --- a/scipy/base/src/arrayobject.c +++ b/scipy/base/src/arrayobject.c @@ -3525,7 +3525,7 @@ array_shape_set(PyArrayObject *self, PyObject *val) ret = PyArray_Reshape(self, val); if (ret == NULL) return -1; - if (self->nd > 0) { /* Free dimensions and strides */ + if (self->nd > 0) { /* Free old dimensions and strides */ PyDimMem_FREE(self->dimensions); } nd = PyArray_NDIM(ret); @@ -3543,6 +3543,7 @@ array_shape_set(PyArrayObject *self, PyObject *val) memcpy(self->strides, PyArray_STRIDES(ret), nd*sizeof(intp)); } + else self->dimensions=NULL; Py_DECREF(ret); return 0; } |