From dcfd8b1d44f873245373e9a4ac7668a2f1e74714 Mon Sep 17 00:00:00 2001 From: Lukasz Taczuk Date: Fri, 26 Apr 2024 23:19:08 +0200 Subject: [PATCH] Update Cython to 3.0.10 --- LICENSE | 2 +- armaclass/Shadow.py | 49 +++++++++++++++++++++++++++++++++-------- requirements-cython.txt | 2 +- 3 files changed, 42 insertions(+), 11 deletions(-) diff --git a/LICENSE b/LICENSE index 8c41584..b743f2b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 Lukasz Taczuk +Copyright (c) 2024 Lukasz Taczuk Copyright (c) 2018 Moritz Schmidt (original JavaScript code) Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/armaclass/Shadow.py b/armaclass/Shadow.py index ded1ba2..586a27b 100644 --- a/armaclass/Shadow.py +++ b/armaclass/Shadow.py @@ -2,7 +2,7 @@ from __future__ import absolute_import # Possible version formats: "3.1.0", "3.1.0a1", "3.1.0a1.dev0" -__version__ = "3.0.0b2" +__version__ = "3.0.10" try: from __builtin__ import basestring @@ -110,22 +110,35 @@ class _Optimization(object): annotation_typing = returns = wraparound = boundscheck = initializedcheck = \ nonecheck = embedsignature = cdivision = cdivision_warnings = \ - always_allows_keywords = profile = linetrace = infer_types = \ - unraisable_tracebacks = freelist = \ + always_allow_keywords = profile = linetrace = infer_types = \ + unraisable_tracebacks = freelist = auto_pickle = cpow = trashcan = \ + auto_cpdef = c_api_binop_methods = \ + allow_none_for_extension_args = callspec = show_performance_hints = \ + cpp_locals = py2_import = iterable_coroutine = remove_unreachable = \ lambda _: _EmptyDecoratorAndManager() +# Note that fast_getattr is untested and undocumented! +fast_getattr = lambda _: _EmptyDecoratorAndManager() + exceptval = lambda _=None, check=True: _EmptyDecoratorAndManager() overflowcheck = lambda _: _EmptyDecoratorAndManager() optimize = _Optimization() -overflowcheck.fold = optimize.use_switch = \ + +embedsignature.format = overflowcheck.fold = optimize.use_switch = \ optimize.unpack_method_calls = lambda arg: _EmptyDecoratorAndManager() -final = internal = type_version_tag = no_gc_clear = no_gc = total_ordering = _empty_decorator +final = internal = type_version_tag = no_gc_clear = no_gc = total_ordering = \ + ufunc = _empty_decorator binding = lambda _: _empty_decorator +class warn: + undeclared = unreachable = maybe_uninitialized = unused = \ + unused_arg = unused_result = \ + lambda _: _EmptyDecoratorAndManager() + _cython_inline = None def inline(f, *args, **kwds): @@ -216,6 +229,7 @@ def __exit__(self, exc_class, exc, tb): nogil = _nogil() gil = _nogil() +with_gil = _nogil() # Actually not a context manager, but compilation will give the right error. del _nogil @@ -437,6 +451,8 @@ def _specialized_from_args(signatures, args, kwargs): 'Py_hash_t', 'Py_ssize_t', 'size_t', + 'ssize_t', + 'ptrdiff_t', ] float_types = [ 'longdouble', @@ -477,7 +493,7 @@ def _specialized_from_args(signatures, args, kwargs): for name in int_types: reprname = to_repr(name, name) gs[name] = typedef(py_int, reprname) - if name not in ('Py_UNICODE', 'Py_UCS4') and not name.endswith('size_t'): + if name not in ('Py_UNICODE', 'Py_UCS4', 'Py_hash_t', 'ptrdiff_t') and not name.endswith('size_t'): gs['u'+name] = typedef(py_int, "unsigned " + reprname) gs['s'+name] = typedef(py_int, "signed " + reprname) @@ -491,10 +507,19 @@ def _specialized_from_args(signatures, args, kwargs): void = typedef(None, "void") Py_tss_t = typedef(None, "Py_tss_t") -for t in int_types + float_types + complex_types + other_types: +for t in int_types: + for i in range(1, 4): + gs["%s_%s" % ('p'*i, t)] = gs[t]._pointer(i) + if 'u'+t in gs: + gs["%s_u%s" % ('p'*i, t)] = gs['u'+t]._pointer(i) + gs["%s_s%s" % ('p'*i, t)] = gs['s'+t]._pointer(i) + +for t in float_types + complex_types + other_types: for i in range(1, 4): gs["%s_%s" % ('p'*i, t)] = gs[t]._pointer(i) +del t, i + NULL = gs['p_void'](0) # looks like 'gs' has some users out there by now... @@ -550,7 +575,6 @@ def __getattr__(self, attr): sys.modules['cython.%s' % self.__name__] = mod return getattr(mod, attr) - class CythonCImports(object): """ Simplistic module mock to make cimports sort-of work in Python code. @@ -564,7 +588,14 @@ def __init__(self, module): def __getattr__(self, item): if item.startswith('__') and item.endswith('__'): raise AttributeError(item) - return __import__(item) + try: + return __import__(item) + except ImportError: + import sys + ex = AttributeError(item) + if sys.version_info >= (3, 0): + ex.__cause__ = None + raise ex import math, sys diff --git a/requirements-cython.txt b/requirements-cython.txt index 9c4114e..d3a6379 100644 --- a/requirements-cython.txt +++ b/requirements-cython.txt @@ -1 +1 @@ -Cython~=3.0b +Cython~=3.0