[Numpy-svn] r3742 - trunk/numpy/core/src

numpy-svn at scipy.org numpy-svn at scipy.org
Thu May 10 17:49:26 EDT 2007


Author: oliphant
Date: 2007-05-10 16:49:22 -0500 (Thu, 10 May 2007)
New Revision: 3742

Modified:
   trunk/numpy/core/src/arrayobject.c
   trunk/numpy/core/src/multiarraymodule.c
Log:
Remove wasteful check.  Fix problem with PyArray_Transpose for large arrays.

Modified: trunk/numpy/core/src/arrayobject.c
===================================================================
--- trunk/numpy/core/src/arrayobject.c	2007-05-10 18:14:29 UTC (rev 3741)
+++ trunk/numpy/core/src/arrayobject.c	2007-05-10 21:49:22 UTC (rev 3742)
@@ -5368,7 +5368,7 @@
                         return NULL;
                 }
                 size *= dims[i];
-                if (size <=0 || size > largest) {
+                if (size > largest) {
                         PyErr_SetString(PyExc_ValueError,
                                         "dimensions too large.");
                         Py_DECREF(descr);

Modified: trunk/numpy/core/src/multiarraymodule.c
===================================================================
--- trunk/numpy/core/src/multiarraymodule.c	2007-05-10 18:14:29 UTC (rev 3741)
+++ trunk/numpy/core/src/multiarraymodule.c	2007-05-10 21:49:22 UTC (rev 3742)
@@ -1875,7 +1875,7 @@
 	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 @@
 	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]];




More information about the Numpy-svn mailing list