fix 'cython.set' and 'cython.frozenset' when set/frozenset are declared names in...
authorStefan Behnel <scoder@users.berlios.de>
Sat, 1 May 2010 16:29:44 +0000 (18:29 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Sat, 1 May 2010 16:29:44 +0000 (18:29 +0200)
Cython/Compiler/ParseTreeTransforms.py
tests/run/set.pyx

index 24a1145bedbf6ee21f04d2dd488e28e4fc2c32cb..adb41c3c22ab06edaeeaea52acf05b2f43bc9704 100644 (file)
@@ -1262,7 +1262,8 @@ class TransformBuiltinMethods(EnvTransform):
             elif attribute == u'NULL':
                 node = NullNode(node.pos)
             elif attribute in (u'set', u'frozenset'):
-                node = NameNode(node.pos, name=EncodedString(attribute))
+                node = NameNode(node.pos, name=EncodedString(attribute),
+                                entry=self.current_env().builtin_scope().lookup_here(attribute))
             elif not PyrexTypes.parse_basic_type(attribute):
                 error(node.pos, u"'%s' not a valid cython attribute or is being used incorrectly" % attribute)
         return node
index 9a0573e9f672980d13976a9fd824f1cb3e7cc69b..d078a672b3c1a4b0bc9eaaae58396359f0ede9ab 100644 (file)
@@ -12,6 +12,14 @@ def cython_set():
     assert set is cython.set
     return cython.set
 
+def cython_set_override():
+    """
+    >>> cython_set_override() is _set
+    True
+    """
+    set = 1
+    return cython.set
+
 def test_set_literal():
     """
     >>> type(test_set_literal()) is _set