From f568a26fadbf7b428f3dc73ebc572277e27b4bf0 Mon Sep 17 00:00:00 2001 From: Vitja Makarov Date: Fri, 7 Jan 2011 15:18:11 +0300 Subject: [PATCH] Make generator body func_cname better --- Cython/Compiler/Nodes.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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)" % ( -- 2.26.2