From b8c14a8d78e3e3ae0d885da3ab24270df915c959 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Sun, 5 Jul 2009 21:24:04 +0200 Subject: [PATCH] Py3 2to3 fix --- Cython/Compiler/Scanning.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 -- 2.26.2