From 20d9cddc2edab59a54c056bb039571aa90c8476f Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Thu, 15 Apr 2010 23:17:10 +0200 Subject: [PATCH] support 'frozenset' in cython namespace (just like 'set') --- Cython/Compiler/ParseTreeTransforms.py | 4 ++-- Cython/Shadow.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cython/Compiler/ParseTreeTransforms.py b/Cython/Compiler/ParseTreeTransforms.py index 01ea5aaa..ce213c96 100644 --- a/Cython/Compiler/ParseTreeTransforms.py +++ b/Cython/Compiler/ParseTreeTransforms.py @@ -1261,8 +1261,8 @@ class TransformBuiltinMethods(EnvTransform): node = BoolNode(node.pos, value=True) elif attribute == u'NULL': node = NullNode(node.pos) - elif attribute == u'set': - node = NameNode(node.pos, name=EncodedString('set')) + elif attribute in (u'set', u'frozenset'): + node = NameNode(node.pos, name=EncodedString(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/Cython/Shadow.py b/Cython/Shadow.py index e3f7f9e7..9175b8a0 100644 --- a/Cython/Shadow.py +++ b/Cython/Shadow.py @@ -162,14 +162,14 @@ except NameError: # Py3 try: # Python 3 - from builtins import set + from builtins import set, frozenset except ImportError: try: # Python 2.4+ - from __builtin__ import set + from __builtin__ import set, frozenset except ImportError: # Py 2.3 - from sets import Set as set + from sets import Set as set, ImmutableSet as frozenset # Predefined types -- 2.26.2