From: Vitja Makarov Date: Fri, 7 Jan 2011 12:18:11 +0000 (+0300) Subject: Make generator body func_cname better X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f568a26fadbf7b428f3dc73ebc572277e27b4bf0;p=cython.git Make generator body func_cname better --- diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index d8b26d7e..55ba0212 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -2950,8 +2950,17 @@ class GeneratorBodyDefNode(DefNode): star_arg=None, starstar_arg=None) self.yields = yields - def create_local_scope(self, env): - """Already done at GeneratorDefNode""" + def declare_generator_body(self, env): + prefix = env.next_id(env.scope_prefix) + entry = env.declare_var(prefix + 'generator', py_object_type, self.pos, visibility='private') + entry.func_cname = \ + Naming.genbody_prefix + prefix + self.name + entry.qualified_name = EncodedString(self.name) + self.entry = entry + + def analyse_declarations(self, env): + self.analyse_argument_types(env) + self.declare_generator_body(env) def generate_function_header(self, code, proto=False): header = "static PyObject *%s(%s, PyObject *%s)" % (