From: Stefan Behnel Date: Thu, 15 Apr 2010 21:17:10 +0000 (+0200) Subject: support 'frozenset' in cython namespace (just like 'set') X-Git-Tag: 0.13.beta0~196 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=20d9cddc2edab59a54c056bb039571aa90c8476f;p=cython.git support 'frozenset' in cython namespace (just like 'set') --- 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