From: Stefan Behnel Date: Sun, 5 Jul 2009 19:24:04 +0000 (+0200) Subject: Py3 2to3 fix X-Git-Tag: 0.12.alpha0~264 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b8c14a8d78e3e3ae0d885da3ab24270df915c959;p=cython.git Py3 2to3 fix --- diff --git a/Cython/Compiler/Scanning.py b/Cython/Compiler/Scanning.py index 9a8e674e..53c0201b 100644 --- a/Cython/Compiler/Scanning.py +++ b/Cython/Compiler/Scanning.py @@ -214,14 +214,18 @@ def initial_compile_time_env(): 'UNAME_VERSION', 'UNAME_MACHINE') for name, value in zip(names, platform.uname()): benv.declare(name, value) - import __builtin__ + import __builtin__ as builtins names = ('False', 'True', 'abs', 'bool', 'chr', 'cmp', 'complex', 'dict', 'divmod', 'enumerate', 'float', 'hash', 'hex', 'int', 'len', 'list', 'long', 'map', 'max', 'min', 'oct', 'ord', 'pow', 'range', 'reduce', 'repr', 'round', 'slice', 'str', 'sum', 'tuple', 'xrange', 'zip') for name in names: - benv.declare(name, getattr(__builtin__, name)) + try: + benv.declare(name, getattr(builtins, name)) + except AttributeError: + # ignore, likely Py3 + pass denv = CompileTimeScope(benv) return denv