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

numpy-svn at scipy.org numpy-svn at scipy.org
Fri Sep 15 12:25:02 CDT 2006


Author: oliphant
Date: 2006-09-15 12:24:44 -0500 (Fri, 15 Sep 2006)
New Revision: 3159

Modified:
   trunk/numpy/core/src/arrayobject.c
Log:
Don't raise errors when setting with a zero-sized array, just exit

Modified: trunk/numpy/core/src/arrayobject.c
===================================================================
--- trunk/numpy/core/src/arrayobject.c	2006-09-15 16:59:14 UTC (rev 3158)
+++ trunk/numpy/core/src/arrayobject.c	2006-09-15 17:24:44 UTC (rev 3159)
@@ -6464,10 +6464,7 @@
         selfit = (PyArrayIterObject *)PyArray_IterNew((PyObject *)self);
         if (selfit == NULL) goto exit;
 
-        if (arrit->size == 0) {
-                PyErr_SetString(PyExc_ValueError, "trying to set with 0-sized array");
-                goto exit;
-        }
+        if (arrit->size == 0) {retval = 0; goto exit;}
 
         swap = PyArray_ISNOTSWAPPED(self) != PyArray_ISNOTSWAPPED(arr);
         copyswap = self->descr->f->copyswap;
@@ -9217,11 +9214,7 @@
         if (arrval==NULL) return -1;
         val_it = (PyArrayIterObject *)PyArray_IterNew(arrval);
         if (val_it==NULL) goto finish;
-        if (val_it->size == 0) {
-                PyErr_SetString(PyExc_ValueError,
-                                "trying to set with zero-sized array");
-                goto finish;
-        }
+        if (val_it->size == 0) {retval = 0; goto finish;}
 
         /* Check for Boolean -- this is first becasue
            Bool is a subclass of Int */



More information about the Numpy-svn mailing list