From: Stefan Behnel Date: Fri, 1 Apr 2011 18:31:54 +0000 (+0200) Subject: minor code cleanup X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c72687b6f5a92b2dd86fed2e0346765f6422b234;p=cython.git minor code cleanup --- diff --git a/Cython/Compiler/ParseTreeTransforms.py b/Cython/Compiler/ParseTreeTransforms.py index 4b491fa5..befdbe29 100644 --- a/Cython/Compiler/ParseTreeTransforms.py +++ b/Cython/Compiler/ParseTreeTransforms.py @@ -1617,8 +1617,9 @@ class CreateClosureClasses(CythonTransform): inner_node.needs_self_code = False node.needs_outer_scope = False + base_type = None if node.is_generator: - generator_class = self.create_generator_class(target_module_scope, node.pos) + base_type = self.create_generator_class(target_module_scope, node.pos) elif not in_closure and not from_closure: return elif not in_closure: @@ -1629,12 +1630,10 @@ class CreateClosureClasses(CythonTransform): as_name = '%s_%s' % (target_module_scope.next_id(Naming.closure_class_prefix), node.entry.cname) - if node.is_generator: - entry = target_module_scope.declare_c_class(name = as_name, - pos = node.pos, defining = True, implementing = True, base_type=generator_class) - else: - entry = target_module_scope.declare_c_class(name = as_name, - pos = node.pos, defining = True, implementing = True) + entry = target_module_scope.declare_c_class( + name=as_name, pos=node.pos, defining=True, + implementing=True, base_type=base_type) + func_scope.scope_class = entry class_scope = entry.type.scope class_scope.is_internal = True