temp result name of YieldExprNode must be allocated in the resume code, not before it
authorStefan Behnel <scoder@users.berlios.de>
Sat, 11 Dec 2010 00:11:00 +0000 (01:11 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Sat, 11 Dec 2010 00:11:00 +0000 (01:11 +0100)
Cython/Compiler/ExprNodes.py

index 1fb7e780bf28a2f9fd91b520e294c9c45f752461..d81ae282a75423a6993eb9d2ea2bc6ab330d5794 100755 (executable)
@@ -4985,7 +4985,6 @@ class YieldExprNode(ExprNode):
     def generate_evaluation_code(self, code):
         self.label_name = code.new_label('resume_from_yield')
         code.use_label(self.label_name)
-        self.allocate_temp_result(code)
         if self.arg:
             self.arg.generate_evaluation_code(code)
             self.arg.make_owned_reference(code)
@@ -5019,6 +5018,7 @@ class YieldExprNode(ExprNode):
             code.putln('%s = %s->%s;' % (cname, Naming.cur_scope_cname, save_cname))
             if type.is_pyobject:
                 code.putln('%s->%s = 0;' % (Naming.cur_scope_cname, save_cname))
+        self.allocate_temp_result(code)
         code.putln('%s = %s; %s' %
                    (self.result(), Naming.sent_value_cname,
                     code.error_goto_if_null(self.result(), self.pos)))