Commit 7559edf1 authored by Robert Bradshaw's avatar Robert Bradshaw

Some error tests for c array iteration.

parent 082aee71
...@@ -306,7 +306,7 @@ class IterationTransform(Visitor.VisitorTransform): ...@@ -306,7 +306,7 @@ class IterationTransform(Visitor.VisitorTransform):
else: else:
if not slice_node.type.is_pyobject: if not slice_node.type.is_pyobject:
error(slice_node.pos, "Invalid C array iteration") error(slice_node.pos, "C array iteration requires known end index")
return node return node
if start: if start:
......
...@@ -3,8 +3,22 @@ def f(obj2): ...@@ -3,8 +3,22 @@ def f(obj2):
obj1 = obj2[ptr1::] # error obj1 = obj2[ptr1::] # error
obj1 = obj2[:ptr1:] # error obj1 = obj2[:ptr1:] # error
obj1 = obj2[::ptr1] # error obj1 = obj2[::ptr1] # error
cdef int a
cdef int* int_ptr
for a in int_ptr:
pass
for a in int_ptr[2:]:
pass
for a in int_ptr[2:2:a]:
pass
_ERRORS = u""" _ERRORS = u"""
3:17: Cannot convert 'int *' to Python object 3:20: Cannot convert 'int *' to Python object
4:18: Cannot convert 'int *' to Python object 4:21: Cannot convert 'int *' to Python object
5:19: Cannot convert 'int *' to Python object 5:22: Cannot convert 'int *' to Python object
10:16: C array iteration requires known end index
12:16: C array iteration requires known end index
14:22: C array iteration requires known step size and end index
""" """
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