Jean-Francois Moulin wrote:
Hi all,

please find in attach the compile errors I got....
this is too cryptic for me too see the link to an actual error in my code...
The only modification I made to a compilable code is to use the numpy buffer
notation for locals in a cdef block which I attach in a second file.

When I looked at it it was actually something else than I thought and much simpler to fix. Fix is now up in the repositories (or apply what I attach yourself to avoid waiting for a release).

Thanks to you and Hoyt for reporting this!

--
Dag Sverre
diff -r bdf4a503b4a2 Cython/Compiler/ExprNodes.py
--- a/Cython/Compiler/ExprNodes.py	Sun Apr 26 08:09:47 2009 +0200
+++ b/Cython/Compiler/ExprNodes.py	Tue Apr 28 15:05:40 2009 +0200
@@ -1705,8 +1705,6 @@ class IndexNode(ExprNode):
             if self.indices:
                 indices = self.indices
             else:
-                # On cloning, indices is cloned. Otherwise, unpack index into indices
-                assert not isinstance(self.index, CloneNode)
                 if isinstance(self.index, TupleNode):
                     indices = self.index.args
                 else:
@@ -1718,6 +1716,9 @@ class IndexNode(ExprNode):
                     x.analyse_types(env)
                     if not x.type.is_int:
                         buffer_access = False
+
+        # On cloning, indices is cloned. Otherwise, unpack index into indices
+        assert not (buffer_access and isinstance(self.index, CloneNode))
 
         if buffer_access:
             self.indices = indices
diff -r bdf4a503b4a2 tests/run/numpy_bufacc_T155.pyx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/run/numpy_bufacc_T155.pyx	Tue Apr 28 15:05:40 2009 +0200
@@ -0,0 +1,15 @@
+"""
+>>> myfunc()
+0.5
+"""
+
+cimport numpy as np
+import numpy as np
+
+def myfunc():
+    cdef np.ndarray[float, ndim=2] A = np.ones((1,1), dtype=np.float32)
+    cdef int i
+
+    for i from 0 <= i < A.shape[0]:
+        A[i, :] /= 2
+    return A[0,0]
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to