From 81161bc83db1f1ccb34c9e45d8abf2a6851713ea Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Sat, 1 May 2010 18:29:44 +0200 Subject: [PATCH] fix 'cython.set' and 'cython.frozenset' when set/frozenset are declared names in the module --- Cython/Compiler/ParseTreeTransforms.py | 3 ++- tests/run/set.pyx | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Cython/Compiler/ParseTreeTransforms.py b/Cython/Compiler/ParseTreeTransforms.py index 24a1145b..adb41c3c 100644 --- a/Cython/Compiler/ParseTreeTransforms.py +++ b/Cython/Compiler/ParseTreeTransforms.py @@ -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 diff --git a/tests/run/set.pyx b/tests/run/set.pyx index 9a0573e9..d078a672 100644 --- a/tests/run/set.pyx +++ b/tests/run/set.pyx @@ -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 -- 2.26.2