Commit 398b0bbd authored by Vitja Makarov's avatar Vitja Makarov

Use generator utility code inside GeneratorDefNode instead of YieldExprNode

parent 109185f0
......@@ -5253,7 +5253,6 @@ class YieldExprNode(ExprNode):
self.arg.analyse_types(env)
if not self.arg.type.is_pyobject:
self.arg = self.arg.coerce_to_pyobject(env)
env.use_utility_code(generator_utility_code)
def generate_evaluation_code(self, code):
self.label_name = code.new_label('resume_from_yield')
......
......@@ -2989,6 +2989,9 @@ class GeneratorDefNode(DefNode):
code.putln("return (PyObject *) %s;" % Naming.cur_scope_cname);
def generate_function_definitions(self, env, code):
from ExprNodes import generator_utility_code
env.use_utility_code(generator_utility_code)
self.gbody.generate_function_header(code, proto=True)
super(GeneratorDefNode, self).generate_function_definitions(env, code)
self.gbody.generate_function_definitions(env, 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