From 087d29ca84e4d22ffb1b2f880529b75dcfa7903b Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Wed, 25 Mar 2009 13:05:22 -0700 Subject: [PATCH] Fix py target for-from loop. --- Cython/Compiler/Nodes.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index d63a4c11..fd341570 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -3949,8 +3949,16 @@ class ForFromStatNode(LoopNode, StatNode): if self.py_loopvar_node: # Reassign py variable to loop var here. # (For consistancy, should rarely come up in practice.) - pass + import ExprNodes + from_py_node = ExprNodes.CoerceFromPyTypeNode(self.loopvar_node.type, self.target, None) + from_py_node.temp_code = loopvar_name + from_py_node.generate_result_code(code) code.putln("}") + if self.py_loopvar_node: + # This is potentially wasteful, but we don't want the semantics to + # depend on whether or not the loop is a python type. + self.py_loopvar_node.generate_evaluation_code(code) + self.target.generate_assignment_code(self.py_loopvar_node, code) break_label = code.break_label code.set_loop_labels(old_loop_labels) if self.else_clause: -- 2.26.2