From: Stefan Behnel Date: Wed, 21 Oct 2009 19:30:39 +0000 (+0200) Subject: fix bug 429: make 'locals' builtin overridable X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=38ceddfda0d5156d7bc95d2d0320b6c603e486ad;p=cython.git fix bug 429: make 'locals' builtin overridable --- diff --git a/Cython/Compiler/ParseTreeTransforms.py b/Cython/Compiler/ParseTreeTransforms.py index 00b47bc7..c760f4d1 100644 --- a/Cython/Compiler/ParseTreeTransforms.py +++ b/Cython/Compiler/ParseTreeTransforms.py @@ -978,8 +978,12 @@ class TransformBuiltinMethods(EnvTransform): # locals builtin if isinstance(node.function, ExprNodes.NameNode): if node.function.name == 'locals': - pos = node.pos lenv = self.env_stack[-1] + entry = lenv.lookup_here('locals') + if entry: + # not the builtin 'locals' + return node + pos = node.pos items = [ExprNodes.DictItemNode(pos, key=ExprNodes.StringNode(pos, value=var), value=ExprNodes.NameNode(pos, name=var)) for var in lenv.entries] diff --git a/tests/bugs.txt b/tests/bugs.txt index dc8b81d0..fed33556 100644 --- a/tests/bugs.txt +++ b/tests/bugs.txt @@ -8,5 +8,4 @@ unsignedbehaviour_T184 bad_c_struct_T252 missing_baseclass_in_predecl_T262 extended_unpacking_T409 -locals_rebind_T429 locals_expressions_T430