diff options
author | Travis Oliphant <oliphant@enthought.com> | 2007-05-10 21:49:22 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2007-05-10 21:49:22 +0000 |
commit | ae13dc354df5e58fb1417ba80fc9c85242224caf (patch) | |
tree | b5369245d7dfc94a00bc3430ce6ecd3985baef32 | |
parent | 4474ba35cd167483589e398539007088dd64b9c5 (diff) | |
download | numpy-ae13dc354df5e58fb1417ba80fc9c85242224caf.tar.gz |
Remove wasteful check. Fix problem with PyArray_Transpose for large arrays.
-rw-r--r-- | numpy/core/src/arrayobject.c | 2 | ||||
-rw-r--r-- | numpy/core/src/multiarraymodule.c | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c index e16e92ec8..3b8c71226 100644 --- a/numpy/core/src/arrayobject.c +++ b/numpy/core/src/arrayobject.c @@ -5368,7 +5368,7 @@ PyArray_NewFromDescr(PyTypeObject *subtype, PyArray_Descr *descr, int nd, return NULL; } size *= dims[i]; - if (size <=0 || size > largest) { + if (size > largest) { PyErr_SetString(PyExc_ValueError, "dimensions too large."); Py_DECREF(descr); diff --git a/numpy/core/src/multiarraymodule.c b/numpy/core/src/multiarraymodule.c index b8e05d6bf..b06440c7f 100644 --- a/numpy/core/src/multiarraymodule.c +++ b/numpy/core/src/multiarraymodule.c @@ -1875,7 +1875,7 @@ PyArray_Transpose(PyArrayObject *ap, PyArray_Dims *permute) ret = (PyArrayObject *)\ PyArray_NewFromDescr(ap->ob_type, ap->descr, - n, permutation, + n, ap->dimensions, NULL, ap->data, ap->flags, (PyObject *)ap); if (ret == NULL) return NULL; @@ -1884,6 +1884,7 @@ PyArray_Transpose(PyArrayObject *ap, PyArray_Dims *permute) ret->base = (PyObject *)ap; Py_INCREF(ap); + /* fix the dimensions and strides of the return-array */ for(i=0; i<n; i++) { ret->dimensions[i] = ap->dimensions[permutation[i]]; ret->strides[i] = ap->strides[permutation[i]]; |