# replace name references in the loop code by their temp node
self.visitchildren(node, ['loop'])
- self.comprehension_targets = outer_comprehension_targets
+ loop = node.loop
+ if type(loop) is Nodes.ForFromStatNode and loop.target.type.is_numeric:
+ loop.loopvar_node = loop.target
+
node.loop = TempsBlockNode(node.pos, body=node.loop, temps=temps)
+ self.comprehension_targets = outer_comprehension_targets
return node
def visit_NameNode(self, node):
--- /dev/null
+u"""
+>>> for_else()
+30
+>>> print( u'*'.join(int_comp()) )
+00*01*02
+"""
+
+def for_else():
+ cdef int i, j=0, k=2
+ for i from 0 <= i < 10:
+ j += k
+ else:
+ k = j+10
+ return k
+
+def int_comp():
+ cdef int i
+ return tuple([ u"%02d" % i
+ for i from 0 <= i < 3 ])