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

numpy-svn@scip... numpy-svn@scip...
Fri Aug 29 07:47:34 CDT 2008


Author: oliphant
Date: 2008-08-29 07:47:34 -0500 (Fri, 29 Aug 2008)
New Revision: 5725

Modified:
   trunk/numpy/core/src/multiarraymodule.c
Log:
Fix 0-length sequence error in #882.

Modified: trunk/numpy/core/src/multiarraymodule.c
===================================================================
--- trunk/numpy/core/src/multiarraymodule.c	2008-08-29 06:45:56 UTC (rev 5724)
+++ trunk/numpy/core/src/multiarraymodule.c	2008-08-29 12:47:34 UTC (rev 5725)
@@ -2199,6 +2199,7 @@
     }
 }
 
+/* Raises error when len(op) == 0 */
 
 /*NUMPY_API*/
 static PyArrayObject **
@@ -2212,6 +2213,9 @@
     NPY_SCALARKIND scalarkind=NPY_NOSCALAR, intypekind=NPY_NOSCALAR;
 
     *retn = n = PySequence_Length(op);
+    if (n == 0) {
+	PyErr_SetString(PyExc_ValueError, "0-length sequence.");
+    }
     if (PyErr_Occurred()) {*retn = 0; return NULL;}
 
     mps = (PyArrayObject **)PyDataMem_NEW(n*sizeof(PyArrayObject *));



More information about the Numpy-svn mailing list