From 9a9ca635999c52a2e0688db68dff0e8047acbcb4 Mon Sep 17 00:00:00 2001 From: Vitja Makarov Date: Wed, 12 Jan 2011 12:29:47 +0300 Subject: [PATCH] Add no_assignment_synthesis flag to DefNode --- Cython/Compiler/ExprNodes.py | 4 +--- Cython/Compiler/Nodes.py | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 82c54836..8e19c397 100755 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -4955,10 +4955,8 @@ class GeneratorExpressionNode(LambdaNode): binding = False def analyse_declarations(self, env): - # XXX: dirty hack to disable assignment synthesis - self.def_node.needs_assignment_synthesis = lambda *args, **kwargs: False + self.def_node.no_assignment_synthesis = True self.def_node.analyse_declarations(env) - #super(GeneratorExpressionNode, self).analyse_declarations(env) env.add_lambda_def(self.def_node) def generate_result_code(self, code): diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index b23b81fb..d71bb599 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -1892,6 +1892,7 @@ class DefNode(FuncDefNode): num_required_kw_args = 0 reqd_kw_flags_cname = "0" is_wrapper = 0 + no_assignment_synthesis = 0 decorators = None return_type_annotation = None entry = None @@ -2227,6 +2228,8 @@ class DefNode(FuncDefNode): self.synthesize_assignment_node(env) def needs_assignment_synthesis(self, env, code=None): + if self.no_assignment_synthesis: + return False # Should enable for module level as well, that will require more testing... if self.entry.is_anonymous: return True -- 2.26.2