Commit 5d1fddb8 authored by Robert Bradshaw's avatar Robert Bradshaw

fix multi-threaded cythonize

parent 6dc1f60c
...@@ -523,7 +523,7 @@ def cythonize(module_list, exclude=[], nthreads=0, aliases=None, quiet=False, fo ...@@ -523,7 +523,7 @@ def cythonize(module_list, exclude=[], nthreads=0, aliases=None, quiet=False, fo
print("Compiling %s because it changed." % source) print("Compiling %s because it changed." % source)
else: else:
print("Compiling %s because it depends on %s." % (source, dep)) print("Compiling %s because it depends on %s." % (source, dep))
to_compile.append((priority, source, c_file, options)) to_compile.append((priority, source, c_file, quiet, options))
new_sources.append(c_file) new_sources.append(c_file)
else: else:
new_sources.append(source) new_sources.append(source)
...@@ -539,7 +539,7 @@ def cythonize(module_list, exclude=[], nthreads=0, aliases=None, quiet=False, fo ...@@ -539,7 +539,7 @@ def cythonize(module_list, exclude=[], nthreads=0, aliases=None, quiet=False, fo
print("multiprocessing required for parallel cythonization") print("multiprocessing required for parallel cythonization")
nthreads = 0 nthreads = 0
if not nthreads: if not nthreads:
for priority, pyx_file, c_file, options in to_compile: for priority, pyx_file, c_file, quiet, options in to_compile:
cythonize_one(pyx_file, c_file, quiet, options) cythonize_one(pyx_file, c_file, quiet, options)
return module_list return module_list
...@@ -549,7 +549,7 @@ def cythonize_one(pyx_file, c_file, quiet, options=None): ...@@ -549,7 +549,7 @@ def cythonize_one(pyx_file, c_file, quiet, options=None):
from Cython.Compiler.Errors import CompileError, PyrexError from Cython.Compiler.Errors import CompileError, PyrexError
if not quiet: if not quiet:
print "Cythonizing %s" % pyx_file print("Cythonizing", pyx_file)
if options is None: if options is None:
options = CompilationOptions(default_options) options = CompilationOptions(default_options)
options.output_file = c_file options.output_file = c_file
......
...@@ -52,6 +52,9 @@ class CompileError(PyrexError): ...@@ -52,6 +52,9 @@ class CompileError(PyrexError):
# Deprecated and withdrawn in 2.6: # Deprecated and withdrawn in 2.6:
# self.message = message # self.message = message
Exception.__init__(self, format_error(message, position)) Exception.__init__(self, format_error(message, position))
# Python Exception subclass pickling is broken,
# see http://bugs.python.org/issue1692335
self.args = (position, message)
class CompileWarning(PyrexWarning): class CompileWarning(PyrexWarning):
...@@ -96,6 +99,9 @@ class CompilerCrash(CompileError): ...@@ -96,6 +99,9 @@ class CompilerCrash(CompileError):
message += u'\n' message += u'\n'
message += u'%s: %s' % (cause.__class__.__name__, cause) message += u'%s: %s' % (cause.__class__.__name__, cause)
CompileError.__init__(self, pos, message) CompileError.__init__(self, pos, message)
# Python Exception subclass pickling is broken,
# see http://bugs.python.org/issue1692335
self.args = (pos, context, message, cause, stacktrace)
class NoElementTreeInstalledException(PyrexError): class NoElementTreeInstalledException(PyrexError):
"""raised when the user enabled options.gdb_debug but no ElementTree """raised when the user enabled options.gdb_debug but no ElementTree
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment