diff --git a/Lib/cu2qu/cython.py b/Lib/cu2qu/cython.py index 4e6f30c..4cc5676 100644 --- a/Lib/cu2qu/cython.py +++ b/Lib/cu2qu/cython.py @@ -6,15 +6,13 @@ # cython.* namespace for pure mode. from __future__ import absolute_import -__version__ = "0.28.5" +__version__ = "0.29.14" try: from __builtin__ import basestring except ImportError: basestring = str -from .errors import InvalidTypeSpecification - # BEGIN shameless copy from Cython/minivect/minitypes.py @@ -48,6 +46,8 @@ def index_type(base_type, item): a 2D strided array of doubles. The syntax is the same as for Cython memoryviews. """ + class InvalidTypeSpecification(Exception): + pass def verify_slice(s): if s.start or s.stop or s.step not in (None, 1): @@ -113,13 +113,14 @@ class _Optimization(object): cclass = ccall = cfunc = _EmptyDecoratorAndManager() returns = wraparound = boundscheck = initializedcheck = nonecheck = \ - overflowcheck = embedsignature = cdivision = cdivision_warnings = \ + embedsignature = cdivision = cdivision_warnings = \ always_allows_keywords = profile = linetrace = infer_types = \ unraisable_tracebacks = freelist = \ lambda _: _EmptyDecoratorAndManager() exceptval = lambda _=None, check=True: _EmptyDecoratorAndManager() +overflowcheck = lambda _: _EmptyDecoratorAndManager() optimization = _Optimization() overflowcheck.fold = optimization.use_switch = \ @@ -190,8 +191,15 @@ def declare(type=None, value=_Unspecified, **kwds): return value class _nogil(object): - """Support for 'with nogil' statement + """Support for 'with nogil' statement and @nogil decorator. """ + def __call__(self, x): + if callable(x): + # Used as function decorator => return the function unchanged. + return x + # Used as conditional context manager or to create an "@nogil(True/False)" decorator => keep going. + return self + def __enter__(self): pass def __exit__(self, exc_class, exc, tb): @@ -201,6 +209,7 @@ def __exit__(self, exc_class, exc, tb): gil = _nogil() del _nogil + # Emulated types class CythonMetaType(type): @@ -451,7 +460,7 @@ class CythonDotParallel(object): def parallel(self, num_threads=None): return nogil - def prange(self, start=0, stop=None, step=1, schedule=None, nogil=False): + def prange(self, start=0, stop=None, step=1, nogil=False, schedule=None, chunksize=None, num_threads=None): if stop is None: stop = start start = 0 diff --git a/Lib/cu2qu/errors.py b/Lib/cu2qu/errors.py index 8604f8f..ff47408 100644 --- a/Lib/cu2qu/errors.py +++ b/Lib/cu2qu/errors.py @@ -63,7 +63,3 @@ def __str__(self): return "fonts contains incompatible glyphs: %s" % ( ", ".join(repr(g) for g in sorted(self.glyph_errors.keys())) ) - - -class InvalidTypeSpecification(Error): - pass