diff options
author | Matti Picus <matti.picus@gmail.com> | 2019-06-07 09:48:37 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-07 09:48:37 +0300 |
commit | edd334cdda888d1cec8ef8caf057f5ae1c8b85d8 (patch) | |
tree | 437541e96f8f58ef613dd0fc8b3e00c1dd9385d1 /numpy | |
parent | f195b6d05d36889528927c9035a367fde5a21bc7 (diff) | |
parent | 57c7d8dc95e563f61b750f68d799bd524f6d0614 (diff) | |
download | numpy-edd334cdda888d1cec8ef8caf057f5ae1c8b85d8.tar.gz |
Merge pull request #13724 from mattip/error-cleanup
MAINT: fix use of cache_dim and 3->2 fix leftover from removing PyArray_MASKNA_STRIDES
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/src/multiarray/getset.c | 2 | ||||
-rw-r--r-- | numpy/core/src/multiarray/methods.c | 7 |
2 files changed, 2 insertions, 7 deletions
diff --git a/numpy/core/src/multiarray/getset.c b/numpy/core/src/multiarray/getset.c index bb7921fa0..bed92403f 100644 --- a/numpy/core/src/multiarray/getset.c +++ b/numpy/core/src/multiarray/getset.c @@ -73,7 +73,7 @@ array_shape_set(PyArrayObject *self, PyObject *val) ((PyArrayObject_fields *)self)->nd = nd; if (nd > 0) { /* create new dimensions and strides */ - ((PyArrayObject_fields *)self)->dimensions = npy_alloc_cache_dim(3*nd); + ((PyArrayObject_fields *)self)->dimensions = npy_alloc_cache_dim(2 * nd); if (PyArray_DIMS(self) == NULL) { Py_DECREF(ret); PyErr_SetString(PyExc_MemoryError,""); diff --git a/numpy/core/src/multiarray/methods.c b/numpy/core/src/multiarray/methods.c index 97eb06769..35bd41707 100644 --- a/numpy/core/src/multiarray/methods.c +++ b/numpy/core/src/multiarray/methods.c @@ -2006,7 +2006,7 @@ array_setstate(PyArrayObject *self, PyObject *args) fa->nd = nd; if (nd > 0) { - fa->dimensions = npy_alloc_cache_dim(3*nd); + fa->dimensions = npy_alloc_cache_dim(2 * nd); if (fa->dimensions == NULL) { return PyErr_NoMemory(); } @@ -2035,8 +2035,6 @@ array_setstate(PyArrayObject *self, PyObject *args) npy_intp num = PyArray_NBYTES(self); fa->data = PyDataMem_NEW(num); if (PyArray_DATA(self) == NULL) { - fa->nd = 0; - npy_free_cache_dim_array(self); Py_DECREF(rawdata); return PyErr_NoMemory(); } @@ -2078,9 +2076,6 @@ array_setstate(PyArrayObject *self, PyObject *args) else { fa->data = PyDataMem_NEW(PyArray_NBYTES(self)); if (PyArray_DATA(self) == NULL) { - fa->nd = 0; - fa->data = PyDataMem_NEW(PyArray_DESCR(self)->elsize); - npy_free_cache_dim_array(self); return PyErr_NoMemory(); } if (PyDataType_FLAGCHK(PyArray_DESCR(self), NPY_NEEDS_INIT)) { |