Commit 091f3d08 authored by Stefan Behnel's avatar Stefan Behnel

store away temp values *after* calculating the yield result value

parent 6cc6b2fc
......@@ -4983,13 +4983,6 @@ class YieldExprNode(ExprNode):
env.use_utility_code(generator_utility_code)
def generate_evaluation_code(self, code):
saved = []
self.temp_allocator.reset()
code.putln('/* Save temporary variables */')
for cname, type, manage_ref in code.funcstate.temps_in_use():
save_cname = self.temp_allocator.allocate_temp(type)
saved.append((cname, save_cname, type))
code.putln('%s->%s = %s;' % (Naming.cur_scope_cname, save_cname, cname))
self.label_name = code.new_label('resume_from_yield')
code.use_label(self.label_name)
self.allocate_temp_result(code)
......@@ -5005,6 +4998,13 @@ class YieldExprNode(ExprNode):
self.arg.free_temps(code)
else:
code.put_init_to_py_none(Naming.retval_cname, py_object_type)
saved = []
self.temp_allocator.reset()
code.putln('/* Save temporary variables */')
for cname, type, manage_ref in code.funcstate.temps_in_use():
save_cname = self.temp_allocator.allocate_temp(type)
saved.append((cname, save_cname, type))
code.putln('%s->%s = %s;' % (Naming.cur_scope_cname, save_cname, cname))
# XXX: safe here as all used temps are handled but not clean
self.temp_allocator.put_giveref(code)
......
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