summaryrefslogtreecommitdiff
blob: b5cde11fa18967c6822baec87fc5c58cfc8ef118 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
https://github.com/cython/cython/commit/b1f7f744b338e97753b5da24037f98397dc751db

--- Cython/Build/Inline.py
+++ Cython/Build/Inline.py
@@ -52,9 +52,12 @@
     symbol_collector = AllSymbols()
     symbol_collector(tree)
     unbound = []
-    import __builtin__
+    try:
+        import builtins
+    except ImportError:
+        import __builtin__ as builtins
     for name in symbol_collector.names:
-        if not tree.scope.lookup(name) and not hasattr(__builtin__, name):
+        if not tree.scope.lookup(name) and not hasattr(builtins, name):
             unbound.append(name)
     return unbound
 
@@ -79,7 +82,7 @@
         return 'numpy.ndarray[numpy.%s_t, ndim=%s]' % (arg.dtype.name, arg.ndim)
     else:
         for base_type in py_type.mro():
-            if base_type.__module__ == '__builtin__':
+            if base_type.__module__ in ('__builtin__', 'builtins'):
                 return 'object'
             module = context.find_module(base_type.__module__, need_pxd=False)
             if module:
@@ -125,7 +128,7 @@
     arg_names.sort()
     arg_sigs = tuple([(get_type(kwds[arg], ctx), arg) for arg in arg_names])
     key = code, arg_sigs, sys.version_info, sys.executable, Cython.__version__
-    module_name = "_cython_inline_" + hashlib.md5(str(key)).hexdigest()
+    module_name = "_cython_inline_" + hashlib.md5(str(key).encode('utf-8')).hexdigest()
     try:
         if not os.path.exists(lib_dir):
             os.makedirs(lib_dir)