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

numpy-svn@scip... numpy-svn@scip...
Thu Aug 28 21:29:23 CDT 2008


Author: cdavid
Date: 2008-08-28 21:29:14 -0500 (Thu, 28 Aug 2008)
New Revision: 5722

Modified:
   trunk/numpy/core/src/multiarraymodule.c
Log:
Fix reshaping 0-sized arrays.

The nocopy logic does not handle 0-sized arrays correctly, so just copy. It is
a not really useful corner case, so doing a copy should not matter much.


Modified: trunk/numpy/core/src/multiarraymodule.c
===================================================================
--- trunk/numpy/core/src/multiarraymodule.c	2008-08-29 02:28:52 UTC (rev 5721)
+++ trunk/numpy/core/src/multiarraymodule.c	2008-08-29 02:29:14 UTC (rev 5722)
@@ -515,8 +515,12 @@
     for (oi=0; oi<oldnd; oi++) op*=olddims[oi];
 
     if (np != op) return 0; /* different total sizes; no hope */
-    if (np == 0) return 1;
 
+    /* the current code does not handle 0-sized arrays, so give up */
+    if (np == 0) {
+        return 0;
+    }
+
     oi = 0;
     oj = 1;
     ni = 0;



More information about the Numpy-svn mailing list