From b469f4712cab35cbbe4398e7272287eafc48e1a1 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Mon, 11 Aug 2008 13:15:45 +0200 Subject: [PATCH] Py2.6/3.0 import fixes --- Cython/Compiler/Buffer.py | 8 ++++++-- Cython/Compiler/ParseTreeTransforms.py | 5 ++++- Cython/Compiler/Symtab.py | 5 ++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Cython/Compiler/Buffer.py b/Cython/Compiler/Buffer.py index 59e63165..45cb8196 100644 --- a/Cython/Compiler/Buffer.py +++ b/Cython/Compiler/Buffer.py @@ -6,9 +6,13 @@ from Cython.Compiler.TreeFragment import TreeFragment from Cython.Utils import EncodedString from Cython.Compiler.Errors import CompileError import PyrexTypes -from sets import Set as set -import textwrap +try: + set +except NameError: + from sets import Set as set + +import textwrap def dedent(text, reindent=0): text = textwrap.dedent(text) if reindent > 0: diff --git a/Cython/Compiler/ParseTreeTransforms.py b/Cython/Compiler/ParseTreeTransforms.py index 97ff9a82..a775f766 100644 --- a/Cython/Compiler/ParseTreeTransforms.py +++ b/Cython/Compiler/ParseTreeTransforms.py @@ -5,7 +5,10 @@ from Cython.Compiler.ExprNodes import * from Cython.Compiler.TreeFragment import TreeFragment from Cython.Utils import EncodedString from Cython.Compiler.Errors import CompileError -from sets import Set as set +try: + set +except NameError: + from sets import Set as set class NormalizeTree(CythonTransform): """ diff --git a/Cython/Compiler/Symtab.py b/Cython/Compiler/Symtab.py index 062ba696..3942faa2 100644 --- a/Cython/Compiler/Symtab.py +++ b/Cython/Compiler/Symtab.py @@ -15,7 +15,10 @@ from TypeSlots import \ get_special_method_signature, get_property_accessor_signature import ControlFlow import __builtin__ -from sets import Set as set +try: + set +except NameError: + from sets import Set as set possible_identifier = re.compile(ur"(?![0-9])\w+$", re.U).match nice_identifier = re.compile('^[a-zA-Z0-0_]+$').match -- 2.26.2