Commit 19ffc8b6 authored by Stefan Behnel's avatar Stefan Behnel

Merge branch 'master' of git+ssh://github.com/cython/cython

parents be1d2f0d 7d231ec4
...@@ -74,6 +74,11 @@ Bugs fixed ...@@ -74,6 +74,11 @@ Bugs fixed
* C++ exception declarations with mapping functions could fail to compile when * C++ exception declarations with mapping functions could fail to compile when
pre-declared in .pxd files. pre-declared in .pxd files.
Other changes
-------------
* Changed mangling scheme in header files generated by ``cdef api``
declarations.
0.22.1 (2015-05-??) 0.22.1 (2015-05-??)
=================== ===================
......
...@@ -832,7 +832,15 @@ def cythonize(module_list, exclude=[], nthreads=0, aliases=None, quiet=False, fo ...@@ -832,7 +832,15 @@ def cythonize(module_list, exclude=[], nthreads=0, aliases=None, quiet=False, fo
if not os.path.exists(options.cache): if not os.path.exists(options.cache):
os.makedirs(options.cache) os.makedirs(options.cache)
to_compile.sort() to_compile.sort()
if len(to_compile) <= 1: # Drop "priority" component of "to_compile" entries and add a
# simple progress indicator.
N = len(to_compile)
progress_fmt = "[{0:%d}/{1}] " % len(str(N))
for i in range(N):
progress = progress_fmt.format(i+1, N)
to_compile[i] = to_compile[i][1:] + (progress,)
if N <= 1:
nthreads = 0 nthreads = 0
if nthreads: if nthreads:
# Requires multiprocessing (or Python >= 2.6) # Requires multiprocessing (or Python >= 2.6)
...@@ -862,7 +870,7 @@ def cythonize(module_list, exclude=[], nthreads=0, aliases=None, quiet=False, fo ...@@ -862,7 +870,7 @@ def cythonize(module_list, exclude=[], nthreads=0, aliases=None, quiet=False, fo
pool.join() pool.join()
if not nthreads: if not nthreads:
for args in to_compile: for args in to_compile:
cythonize_one(*args[1:]) cythonize_one(*args)
if exclude_failures: if exclude_failures:
failed_modules = set() failed_modules = set()
...@@ -927,7 +935,7 @@ else: ...@@ -927,7 +935,7 @@ else:
# TODO: Share context? Issue: pyx processing leaks into pxd module # TODO: Share context? Issue: pyx processing leaks into pxd module
@record_results @record_results
def cythonize_one(pyx_file, c_file, fingerprint, quiet, options=None, raise_on_failure=True, embedded_metadata=None): def cythonize_one(pyx_file, c_file, fingerprint, quiet, options=None, raise_on_failure=True, embedded_metadata=None, progress=""):
from ..Compiler.Main import compile, default_options from ..Compiler.Main import compile, default_options
from ..Compiler.Errors import CompileError, PyrexError from ..Compiler.Errors import CompileError, PyrexError
...@@ -944,7 +952,7 @@ def cythonize_one(pyx_file, c_file, fingerprint, quiet, options=None, raise_on_f ...@@ -944,7 +952,7 @@ def cythonize_one(pyx_file, c_file, fingerprint, quiet, options=None, raise_on_f
options.cache, "%s-%s%s" % (os.path.basename(c_file), fingerprint, gzip_ext)) options.cache, "%s-%s%s" % (os.path.basename(c_file), fingerprint, gzip_ext))
if os.path.exists(fingerprint_file): if os.path.exists(fingerprint_file):
if not quiet: if not quiet:
print("Found compiled %s in cache" % pyx_file) print("%sFound compiled %s in cache" % (progress, pyx_file))
os.utime(fingerprint_file, None) os.utime(fingerprint_file, None)
g = gzip_open(fingerprint_file, 'rb') g = gzip_open(fingerprint_file, 'rb')
try: try:
...@@ -957,7 +965,7 @@ def cythonize_one(pyx_file, c_file, fingerprint, quiet, options=None, raise_on_f ...@@ -957,7 +965,7 @@ def cythonize_one(pyx_file, c_file, fingerprint, quiet, options=None, raise_on_f
g.close() g.close()
return return
if not quiet: if not quiet:
print("Cythonizing %s" % pyx_file) print("%sCythonizing %s" % (progress, 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
...@@ -1000,7 +1008,7 @@ def cythonize_one(pyx_file, c_file, fingerprint, quiet, options=None, raise_on_f ...@@ -1000,7 +1008,7 @@ def cythonize_one(pyx_file, c_file, fingerprint, quiet, options=None, raise_on_f
def cythonize_one_helper(m): def cythonize_one_helper(m):
import traceback import traceback
try: try:
return cythonize_one(*m[1:]) return cythonize_one(*m)
except Exception: except Exception:
traceback.print_exc() traceback.print_exc()
raise raise
......
...@@ -223,14 +223,14 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -223,14 +223,14 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
h_code.putln("") h_code.putln("")
for entry in api_funcs: for entry in api_funcs:
type = CPtrType(entry.type) type = CPtrType(entry.type)
cname = env.mangle(Naming.func_prefix, entry.name) cname = env.mangle(Naming.func_prefix_api, entry.name)
h_code.putln("static %s = 0;" % type.declaration_code(cname)) h_code.putln("static %s = 0;" % type.declaration_code(cname))
h_code.putln("#define %s %s" % (entry.name, cname)) h_code.putln("#define %s %s" % (entry.name, cname))
if api_vars: if api_vars:
h_code.putln("") h_code.putln("")
for entry in api_vars: for entry in api_vars:
type = CPtrType(entry.type) type = CPtrType(entry.type)
cname = env.mangle(Naming.varptr_prefix, entry.name) cname = env.mangle(Naming.varptr_prefix_api, entry.name)
h_code.putln("static %s = 0;" % type.declaration_code(cname)) h_code.putln("static %s = 0;" % type.declaration_code(cname))
h_code.putln("#define %s (*%s)" % (entry.name, cname)) h_code.putln("#define %s (*%s)" % (entry.name, cname))
h_code.put(UtilityCode.load_as_string("PyIdentifierFromString", "ImportExport.c")[0]) h_code.put(UtilityCode.load_as_string("PyIdentifierFromString", "ImportExport.c")[0])
...@@ -247,13 +247,13 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -247,13 +247,13 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
h_code.putln('module = __Pyx_ImportModule("%s");' % env.qualified_name) h_code.putln('module = __Pyx_ImportModule("%s");' % env.qualified_name)
h_code.putln("if (!module) goto bad;") h_code.putln("if (!module) goto bad;")
for entry in api_funcs: for entry in api_funcs:
cname = env.mangle(Naming.func_prefix, entry.name) cname = env.mangle(Naming.func_prefix_api, entry.name)
sig = entry.type.signature_string() sig = entry.type.signature_string()
h_code.putln( h_code.putln(
'if (__Pyx_ImportFunction(module, "%s", (void (**)(void))&%s, "%s") < 0) goto bad;' 'if (__Pyx_ImportFunction(module, "%s", (void (**)(void))&%s, "%s") < 0) goto bad;'
% (entry.name, cname, sig)) % (entry.name, cname, sig))
for entry in api_vars: for entry in api_vars:
cname = env.mangle(Naming.varptr_prefix, entry.name) cname = env.mangle(Naming.varptr_prefix_api, entry.name)
sig = entry.type.empty_declaration_code() sig = entry.type.empty_declaration_code()
h_code.putln( h_code.putln(
'if (__Pyx_ImportVoidPtr(module, "%s", (void **)&%s, "%s") < 0) goto bad;' 'if (__Pyx_ImportVoidPtr(module, "%s", (void **)&%s, "%s") < 0) goto bad;'
......
...@@ -18,6 +18,7 @@ arg_prefix = pyrex_prefix + "arg_" ...@@ -18,6 +18,7 @@ arg_prefix = pyrex_prefix + "arg_"
funcdoc_prefix = pyrex_prefix + "doc_" funcdoc_prefix = pyrex_prefix + "doc_"
enum_prefix = pyrex_prefix + "e_" enum_prefix = pyrex_prefix + "e_"
func_prefix = pyrex_prefix + "f_" func_prefix = pyrex_prefix + "f_"
func_prefix_api = pyrex_prefix + "api_f_"
pyfunc_prefix = pyrex_prefix + "pf_" pyfunc_prefix = pyrex_prefix + "pf_"
pywrap_prefix = pyrex_prefix + "pw_" pywrap_prefix = pyrex_prefix + "pw_"
genbody_prefix = pyrex_prefix + "gb_" genbody_prefix = pyrex_prefix + "gb_"
...@@ -36,6 +37,7 @@ type_prefix = pyrex_prefix + "t_" ...@@ -36,6 +37,7 @@ type_prefix = pyrex_prefix + "t_"
typeobj_prefix = pyrex_prefix + "type_" typeobj_prefix = pyrex_prefix + "type_"
var_prefix = pyrex_prefix + "v_" var_prefix = pyrex_prefix + "v_"
varptr_prefix = pyrex_prefix + "vp_" varptr_prefix = pyrex_prefix + "vp_"
varptr_prefix_api = pyrex_prefix + "api_vp_"
wrapperbase_prefix= pyrex_prefix + "wrapperbase_" wrapperbase_prefix= pyrex_prefix + "wrapperbase_"
pybuffernd_prefix = pyrex_prefix + "pybuffernd_" pybuffernd_prefix = pyrex_prefix + "pybuffernd_"
pybufferstruct_prefix = pyrex_prefix + "pybuffer_" pybufferstruct_prefix = pyrex_prefix + "pybuffer_"
......
...@@ -331,13 +331,13 @@ Cython code. Here is the list of currently supported directives: ...@@ -331,13 +331,13 @@ Cython code. Here is the list of currently supported directives:
the operands have opposite signs) and raise a the operands have opposite signs) and raise a
``ZeroDivisionError`` when the right operand is 0. This has up to ``ZeroDivisionError`` when the right operand is 0. This has up to
a 35% speed penalty. If set to True, no checks are performed. See a 35% speed penalty. If set to True, no checks are performed. See
`CEP 516 <http://wiki.cython.org/enhancements/division>`_. Default `CEP 516 <https://github.com/cython/cython/wiki/enhancements-division>`_. Default
is False. is False.
``cdivision_warnings`` (True / False) ``cdivision_warnings`` (True / False)
If set to True, Cython will emit a runtime warning whenever If set to True, Cython will emit a runtime warning whenever
division is performed with negative operands. See `CEP 516 division is performed with negative operands. See `CEP 516
<http://wiki.cython.org/enhancements/division>`_. Default is <https://github.com/cython/cython/wiki/enhancements-division>`_. Default is
False. False.
``always_allow_keywords`` (True / False) ``always_allow_keywords`` (True / False)
......
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