handle failure to create a process pool in cythonize() by falling back to a single...
authorStefan Behnel <stefan_ml@behnel.de>
Sat, 10 Aug 2013 13:20:56 +0000 (15:20 +0200)
committerStefan Behnel <stefan_ml@behnel.de>
Sat, 10 Aug 2013 13:20:56 +0000 (15:20 +0200)
Cython/Build/Dependencies.py

index a06fe40..d718504 100644 (file)
@@ -754,10 +754,11 @@ def cythonize(module_list, exclude=[], nthreads=0, aliases=None, quiet=False, fo
         try:
             import multiprocessing
             pool = multiprocessing.Pool(nthreads)
-            pool.map(cythonize_one_helper, to_compile)
-        except ImportError:
+        except (ImportError, OSError):
             print("multiprocessing required for parallel cythonization")
             nthreads = 0
+        else:
+            pool.map(cythonize_one_helper, to_compile)
     if not nthreads:
         for args in to_compile:
             cythonize_one(*args[1:])