Skip to content
This repository has been archived by the owner on Aug 9, 2023. It is now read-only.

Commit

Permalink
Update Cython module, remove its internal error (#189)
Browse files Browse the repository at this point in the history
Update Cython module, remove its internal error from the public errors module
  • Loading branch information
madig authored Feb 7, 2020
1 parent 3cbd848 commit eaeef05
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
21 changes: 15 additions & 6 deletions Lib/cu2qu/cython.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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 = \
Expand Down Expand Up @@ -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):
Expand All @@ -201,6 +209,7 @@ def __exit__(self, exc_class, exc, tb):
gil = _nogil()
del _nogil


# Emulated types

class CythonMetaType(type):
Expand Down Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions Lib/cu2qu/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit eaeef05

Please sign in to comment.