fix bug 429: make 'locals' builtin overridable
authorStefan Behnel <scoder@users.berlios.de>
Wed, 21 Oct 2009 19:30:39 +0000 (21:30 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Wed, 21 Oct 2009 19:30:39 +0000 (21:30 +0200)
Cython/Compiler/ParseTreeTransforms.py
tests/bugs.txt

index 00b47bc74cc3da82daed9ad6f3897d6a69f5fb4d..c760f4d14d9f2eda31b260a5e692cb70895071dd 100644 (file)
@@ -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]
index dc8b81d016c6cd9285dedd30f6421045750a94d1..fed33556d1b7bfa07605b59179464b0f68a14c1e 100644 (file)
@@ -8,5 +8,4 @@ unsignedbehaviour_T184
 bad_c_struct_T252
 missing_baseclass_in_predecl_T262
 extended_unpacking_T409
-locals_rebind_T429
 locals_expressions_T430