[Numpy-svn] r4467 - in trunk/numpy/core: src tests

numpy-svn@scip... numpy-svn@scip...
Sun Nov 18 16:44:32 CST 2007


Author: stefan
Date: 2007-11-18 16:44:06 -0600 (Sun, 18 Nov 2007)
New Revision: 4467

Modified:
   trunk/numpy/core/src/arrayobject.c
   trunk/numpy/core/tests/test_regression.py
Log:
Fix indexing with array scalar. Closes #603.


Modified: trunk/numpy/core/src/arrayobject.c
===================================================================
--- trunk/numpy/core/src/arrayobject.c	2007-11-18 20:49:47 UTC (rev 4466)
+++ trunk/numpy/core/src/arrayobject.c	2007-11-18 22:44:06 UTC (rev 4467)
@@ -3045,8 +3045,7 @@
         if ((op == Py_Ellipsis) || PyString_Check(op) || PyUnicode_Check(op))
             noellipses = FALSE;
         else if (PyBool_Check(op) || PyArray_IsScalar(op, Bool) ||
-                 (PyArray_Check(op) && (PyArray_DIMS(op)==0) &&
-                  PyArray_ISBOOL(op)))
+                 (PyArray_Check(op) && (PyArray_DIMS(op)==0)))
             noellipses = FALSE;
         else if (PySequence_Check(op)) {
             int n, i;

Modified: trunk/numpy/core/tests/test_regression.py
===================================================================
--- trunk/numpy/core/tests/test_regression.py	2007-11-18 20:49:47 UTC (rev 4466)
+++ trunk/numpy/core/tests/test_regression.py	2007-11-18 22:44:06 UTC (rev 4467)
@@ -762,6 +762,12 @@
         def ia(x,s): x[(s>0)]=1.0
         self.failUnlessRaises(ValueError,ia,x,s)
 
+    def check_mem_scalar_indexing(self, level=rlevel):
+        """Ticket #603"""
+        x = N.array([0],dtype=float)
+        index = N.array(0,dtype=N.int32)
+        x[index]
 
+
 if __name__ == "__main__":
     NumpyTest().run()



More information about the Numpy-svn mailing list