Commit 5ddddeed authored by Dag Sverre Seljebotn's avatar Dag Sverre Seljebotn

Simple fix for #155

parent 31c250b2
...@@ -1705,8 +1705,6 @@ class IndexNode(ExprNode): ...@@ -1705,8 +1705,6 @@ class IndexNode(ExprNode):
if self.indices: if self.indices:
indices = self.indices indices = self.indices
else: else:
# On cloning, indices is cloned. Otherwise, unpack index into indices
assert not isinstance(self.index, CloneNode)
if isinstance(self.index, TupleNode): if isinstance(self.index, TupleNode):
indices = self.index.args indices = self.index.args
else: else:
...@@ -1719,6 +1717,9 @@ class IndexNode(ExprNode): ...@@ -1719,6 +1717,9 @@ class IndexNode(ExprNode):
if not x.type.is_int: if not x.type.is_int:
buffer_access = False 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: if buffer_access:
self.indices = indices self.indices = indices
self.index = None self.index = None
......
...@@ -150,6 +150,7 @@ class TreeVisitor(BasicVisitor): ...@@ -150,6 +150,7 @@ class TreeVisitor(BasicVisitor):
except Errors.CompileError: except Errors.CompileError:
raise raise
except Exception, e: except Exception, e:
raise
import sys import sys
trace = [''] trace = ['']
for parent, attribute, index in self.access_path: for parent, attribute, index in self.access_path:
......
"""
>>> 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]
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment