Python 3 fixes
authorRobert Bradshaw <robertwb@math.washington.edu>
Sat, 12 Sep 2009 02:10:18 +0000 (19:10 -0700)
committerRobert Bradshaw <robertwb@math.washington.edu>
Sat, 12 Sep 2009 02:10:18 +0000 (19:10 -0700)
Cython/Shadow.py
Cython/__init__.py
pyximport/pyximport.py

index 1fe9dc19a540b8539d439cc5d87b5d6305245ce8..f943e6a85bbd7b4304c27cbfb7d69870acede636 100644 (file)
@@ -151,8 +151,12 @@ class typedef(CythonType):
 
 
 py_int = int
-py_long = long
 py_float = float
+try:
+    py_long = long
+except NameError:
+    # Python 3
+    pass
 
 
 # Predefined types
index 5ef285c09faad7113958951caa39efc6d5d697b3..f9f635d1f92ae0e1f8feb83fb7277a543aa5acaf 100644 (file)
@@ -1,2 +1,2 @@
 # Void cython.* directives (for case insensitive operating systems). 
-from Shadow import *
+from Cython.Shadow import *
index 42e397ff2398857a3ff3e950c49cc32f49a14e30..f12e100baa06d7d8289cf52ed9cb95a42a0f81ae 100644 (file)
@@ -117,7 +117,7 @@ def handle_dependencies(pyxfilename):
         # be tricked into rebuilding it.
         for file in files:
             if newer(file, pyxfilename):
-                print "Rebuilding because of ", file
+                print("Rebuilding because of ", file)
                 filetime = os.path.getmtime(file)
                 os.utime(pyxfilename, (filetime, filetime))
                 _test_files.append(file)
@@ -141,7 +141,7 @@ def build_module(name, pyxfilename, pyxbuild_dir=None):
             try:
                 os.remove(path)
             except IOError:
-                print "Couldn't remove ", path
+                print("Couldn't remove ", path)
 
     return so_path
 
@@ -168,7 +168,7 @@ class PyxImporter(object):
         if fullname in sys.modules:
             return None
         if DEBUG_IMPORT:
-            print "SEARCHING", fullname, package_path
+            print("SEARCHING", fullname, package_path)
         if '.' in fullname:
             mod_parts = fullname.split('.')
             package = '.'.join(mod_parts[:-1])
@@ -226,7 +226,7 @@ class PyImporter(PyxImporter):
             # prevent infinite recursion
             return None
         if DEBUG_IMPORT:
-            print "trying import of module %s" % fullname
+            print("trying import of module", fullname)
         if fullname in self.uncompilable_modules:
             path, last_modified = self.uncompilable_modules[fullname]
             try:
@@ -243,7 +243,7 @@ class PyImporter(PyxImporter):
             importer = self.super.find_module(fullname, package_path)
             if importer is not None:
                 if DEBUG_IMPORT:
-                    print "importer found"
+                    print("importer found")
                 try:
                     if importer.init_path:
                         path = importer.init_path