Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-Cython for openSUSE:Factory checked in at 2024-01-15 22:11:25 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-Cython (Old) and /work/SRC/openSUSE:Factory/.python-Cython.new.21961 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-Cython" Mon Jan 15 22:11:25 2024 rev:81 rq:1138672 version:3.0.8 Changes: -------- --- /work/SRC/openSUSE:Factory/python-Cython/python-Cython.changes 2024-01-05 22:59:19.181683533 +0100 +++ /work/SRC/openSUSE:Factory/.python-Cython.new.21961/python-Cython.changes 2024-01-15 22:11:35.646086996 +0100 @@ -1,0 +2,16 @@ +Sun Jan 14 15:30:24 UTC 2024 - Dirk Müller <dmuel...@suse.com> + +- update to 3.0.8: + * Using const together with defined fused types could fail to + compile. (Github issue :issue:`5230`) + * A "use after free" bug was fixed in parallel sections. + (Github issue :issue:`5922`) + * Several types were not available as cython.* types in pure + Python code. + * The generated code is now correct C89 again, removing some + C++ style // comments and C99-style declaration-after-code + code ordering. This is still relevant for some ols C + compilers, specifically ones that match old Python 2.7 + installations. + +------------------------------------------------------------------- Old: ---- Cython-3.0.7.tar.gz New: ---- Cython-3.0.8.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-Cython.spec ++++++ --- /var/tmp/diff_new_pack.HviWrg/_old 2024-01-15 22:11:36.218107916 +0100 +++ /var/tmp/diff_new_pack.HviWrg/_new 2024-01-15 22:11:36.222108062 +0100 @@ -19,7 +19,7 @@ %bcond_with test %{?sle15_python_module_pythons} Name: python-Cython -Version: 3.0.7 +Version: 3.0.8 Release: 0 Summary: The Cython compiler for writing C extensions for the Python language License: Apache-2.0 ++++++ Cython-3.0.7.tar.gz -> Cython-3.0.8.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-3.0.7/.gitrev new/Cython-3.0.8/.gitrev --- old/Cython-3.0.7/.gitrev 2023-12-19 12:00:42.980816800 +0100 +++ new/Cython-3.0.8/.gitrev 2024-01-10 10:54:50.816723800 +0100 @@ -1 +1 @@ -f17009c232d0cb5f68cb279bc16d6764e9576426 +a1b79a6bc5326406ad73af73f5b41e3bb5f8da6e diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-3.0.7/CHANGES.rst new/Cython-3.0.8/CHANGES.rst --- old/Cython-3.0.7/CHANGES.rst 2023-12-19 12:00:40.308840000 +0100 +++ new/Cython-3.0.8/CHANGES.rst 2024-01-10 10:54:48.308722300 +0100 @@ -2,6 +2,25 @@ Cython Changelog ================ +3.0.8 (2024-01-10) +================== + +Bugs fixed +---------- + +* Using ``const`` together with defined fused types could fail to compile. + (Github issue :issue:`5230`) + +* A "use after free" bug was fixed in parallel sections. + (Github issue :issue:`5922`) + +* Several types were not available as ``cython.*`` types in pure Python code. + +* The generated code is now correct C89 again, removing some C++ style ``//`` comments + and C99-style declaration-after-code code ordering. This is still relevant for some + ols C compilers, specifically ones that match old Python 2.7 installations. + + 3.0.7 (2023-12-19) ================== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-3.0.7/Cython/Compiler/FusedNode.py new/Cython-3.0.8/Cython/Compiler/FusedNode.py --- old/Cython-3.0.7/Cython/Compiler/FusedNode.py 2023-12-19 12:00:40.316840000 +0100 +++ new/Cython-3.0.8/Cython/Compiler/FusedNode.py 2024-01-10 10:54:48.316722200 +0100 @@ -3,7 +3,8 @@ import copy from . import (ExprNodes, PyrexTypes, MemoryView, - ParseTreeTransforms, StringEncoding, Errors) + ParseTreeTransforms, StringEncoding, Errors, + Naming) from .ExprNodes import CloneNode, ProxyNode, TupleNode from .Nodes import FuncDefNode, CFuncDefNode, StatListNode, DefNode from ..Utils import OrderedSet @@ -307,9 +308,10 @@ """) def _dtype_name(self, dtype): + name = str(dtype).replace('_', '__').replace(' ', '_') if dtype.is_typedef: - return '___pyx_%s' % dtype - return str(dtype).replace(' ', '_') + name = Naming.fused_dtype_prefix + name + return name def _dtype_type(self, dtype): if dtype.is_typedef: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-3.0.7/Cython/Compiler/Naming.py new/Cython-3.0.8/Cython/Compiler/Naming.py --- old/Cython-3.0.7/Cython/Compiler/Naming.py 2023-12-19 12:00:40.316840000 +0100 +++ new/Cython-3.0.8/Cython/Compiler/Naming.py 2024-01-10 10:54:48.316722200 +0100 @@ -132,6 +132,7 @@ error_without_exception_cname = pyrex_prefix + "error_without_exception" binding_cfunc = pyrex_prefix + "binding_PyCFunctionType" fused_func_prefix = pyrex_prefix + 'fuse_' +fused_dtype_prefix = pyrex_prefix + 'fused_dtype_' quick_temp_cname = pyrex_prefix + "temp" # temp variable for quick'n'dirty temping tp_dict_version_temp = pyrex_prefix + "tp_dict_version" obj_dict_version_temp = pyrex_prefix + "obj_dict_version" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-3.0.7/Cython/Compiler/Nodes.py new/Cython-3.0.8/Cython/Compiler/Nodes.py --- old/Cython-3.0.7/Cython/Compiler/Nodes.py 2023-12-19 12:00:40.316840000 +0100 +++ new/Cython-3.0.8/Cython/Compiler/Nodes.py 2024-01-10 10:54:48.316722200 +0100 @@ -8610,6 +8610,8 @@ if self.is_try_finally_in_nogil: code.put_ensure_gil(declare_gilstate=False) + # although the thread state is already assigned, that can't be trusted after releasing the GIL + code.putln("__Pyx_PyThreadState_assign") # not using preprocessor here to avoid warnings about # unused utility functions and/or temps @@ -8636,6 +8638,8 @@ code.globalstate.use_utility_code(reset_exception_utility_code) if self.is_try_finally_in_nogil: code.put_ensure_gil(declare_gilstate=False) + # although the thread state is already assigned, that can't be trusted after releasing the GIL + code.putln("__Pyx_PyThreadState_assign") # not using preprocessor here to avoid warnings about # unused utility functions and/or temps diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-3.0.7/Cython/Compiler/PyrexTypes.py new/Cython-3.0.8/Cython/Compiler/PyrexTypes.py --- old/Cython-3.0.7/Cython/Compiler/PyrexTypes.py 2023-12-19 12:00:40.320840000 +0100 +++ new/Cython-3.0.8/Cython/Compiler/PyrexTypes.py 2024-01-10 10:54:48.320722000 +0100 @@ -5321,6 +5321,8 @@ signed = 2 elif name == 'size_t': signed = 0 + elif name == 'ptrdiff_t': + signed = 2 else: if name.startswith('u'): name = name[1:] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-3.0.7/Cython/Shadow.py new/Cython-3.0.8/Cython/Shadow.py --- old/Cython-3.0.7/Cython/Shadow.py 2023-12-19 12:00:40.332839700 +0100 +++ new/Cython-3.0.8/Cython/Shadow.py 2024-01-10 10:54:48.332722200 +0100 @@ -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.7" +__version__ = "3.0.8" try: from __builtin__ import basestring @@ -451,6 +451,8 @@ 'Py_hash_t', 'Py_ssize_t', 'size_t', + 'ssize_t', + 'ptrdiff_t', ] float_types = [ 'longdouble', @@ -491,7 +493,7 @@ 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) @@ -505,9 +507,18 @@ 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) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-3.0.7/Cython/Tests/TestShadow.py new/Cython-3.0.8/Cython/Tests/TestShadow.py --- old/Cython-3.0.7/Cython/Tests/TestShadow.py 1970-01-01 01:00:00.000000000 +0100 +++ new/Cython-3.0.8/Cython/Tests/TestShadow.py 2024-01-10 10:54:48.332722200 +0100 @@ -0,0 +1,79 @@ +import unittest + +from Cython import Shadow +from Cython.Compiler import Options, CythonScope, PyrexTypes, Errors + +class TestShadow(unittest.TestCase): + def test_all_types_in_shadow(self): + cython_scope = CythonScope.create_cython_scope(None) + # Not doing load_cythonscope at this stage because it requires a proper context and + # Errors.py to be set up + + missing_types = [] + for key in cython_scope.entries.keys(): + if key.startswith('__') and key.endswith('__'): + continue + if key in ('PyTypeObject', 'PyObject_TypeCheck'): + # These are declared in Shadow.py for reasons that look to + # be an implementation detail, but it isn't our intention for + # users to access them from Pure Python mode. + continue + if not hasattr(Shadow, key): + missing_types.append(key) + self.assertEqual(missing_types, []) + + def test_int_types_in_shadow(self): + missing_types = [] + for int_name in Shadow.int_types: + for sign in ['', 'u', 's']: + name = sign + int_name + + if sign and ( + int_name in ['Py_UNICODE', 'Py_UCS4', 'Py_ssize_t', + 'ssize_t', 'ptrdiff_t', 'Py_hash_t'] or + name == "usize_t"): + # size_t is special-cased here a little since ssize_t legitimate + # but usize_t isn't + self.assertNotIn(name, dir(Shadow)) + self.assertNotIn('p_' + name, dir(Shadow)) + continue + + if not hasattr(Shadow, name): + missing_types.append(name) + + for ptr in range(1, 4): + ptr_name = 'p' * ptr + '_' + name + if not hasattr(Shadow, ptr_name): + missing_types.append(ptr_name) + self.assertEqual(missing_types, []) + + def test_most_types(self): + # TODO it's unfortunately hard to get a definite list of types to confirm that they're + # present (because they're obtained by on-the-fly string parsing in `cython_scope.lookup_type`) + + cython_scope = CythonScope.create_cython_scope(None) + # Set up just enough of "Context" and "Errors" that CythonScope.lookup_type can fail + class Context: + cpp = False + language_level = 3 + future_directives = [] + cython_scope.context = Context + Errors.init_thread() + + missing_types = [] + missing_lookups = [] + for (signed, longness, name), type_ in PyrexTypes.modifiers_and_name_to_type.items(): + if name == 'object': + continue # This probably shouldn't be in Shadow + if not hasattr(Shadow, name): + missing_types.append(name) + if not cython_scope.lookup_type(name): + missing_lookups.append(name) + for ptr in range(1, 4): + ptr_name = 'p' * ptr + '_' + name + if not hasattr(Shadow, ptr_name): + missing_types.append(ptr_name) + if not cython_scope.lookup_type(ptr_name): + missing_lookups.append(ptr_name) + self.assertEqual(missing_types, []) + self.assertEqual(missing_lookups, []) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-3.0.7/Cython/Utility/CythonFunction.c new/Cython-3.0.8/Cython/Utility/CythonFunction.c --- old/Cython-3.0.7/Cython/Utility/CythonFunction.c 2023-12-19 12:00:40.336840000 +0100 +++ new/Cython-3.0.8/Cython/Utility/CythonFunction.c 2024-01-10 10:54:48.336722100 +0100 @@ -58,7 +58,7 @@ // Dynamic default args and annotations void *defaults; int defaults_pyobjects; - size_t defaults_size; // used by FusedFunction for copying defaults + size_t defaults_size; /* used by FusedFunction for copying defaults */ int flags; // Defaults info diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-3.0.7/Cython/Utility/Dataclasses.c new/Cython-3.0.8/Cython/Utility/Dataclasses.c --- old/Cython-3.0.7/Cython/Utility/Dataclasses.c 2023-12-19 12:00:40.336840000 +0100 +++ new/Cython-3.0.8/Cython/Utility/Dataclasses.c 2024-01-10 10:54:48.336722100 +0100 @@ -39,7 +39,7 @@ if (!module) { PyObject *localDict, *runValue, *builtins, *modulename; if (!PyErr_ExceptionMatches(PyExc_ImportError)) goto bad; - PyErr_Clear(); // this is reasonably likely (especially on older versions of Python) + PyErr_Clear(); /* this is reasonably likely (especially on older versions of Python) */ #if PY_MAJOR_VERSION < 3 modulename = PyBytes_FromFormat("_cython_" CYTHON_ABI ".%s", name); #else @@ -47,17 +47,17 @@ #endif if (!modulename) goto bad; #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_CPYTHON - module = PyImport_AddModuleObject(modulename); // borrowed + module = PyImport_AddModuleObject(modulename); /* borrowed */ #else - module = PyImport_AddModule(PyBytes_AsString(modulename)); // borrowed + module = PyImport_AddModule(PyBytes_AsString(modulename)); /* borrowed */ #endif Py_DECREF(modulename); if (!module) goto bad; Py_INCREF(module); if (PyObject_SetAttrString(shared_abi_module, name, module) < 0) goto bad; - localDict = PyModule_GetDict(module); // borrowed + localDict = PyModule_GetDict(module); /* borrowed */ if (!localDict) goto bad; - builtins = PyEval_GetBuiltins(); // borrowed + builtins = PyEval_GetBuiltins(); /* borrowed */ if (!builtins) goto bad; if (PyDict_SetItemString(localDict, "__builtins__", builtins) <0) goto bad; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-3.0.7/Cython/Utility/Exceptions.c new/Cython-3.0.8/Cython/Utility/Exceptions.c --- old/Cython-3.0.7/Cython/Utility/Exceptions.c 2023-12-19 12:00:40.336840000 +0100 +++ new/Cython-3.0.8/Cython/Utility/Exceptions.c 2024-01-10 10:54:48.336722100 +0100 @@ -1083,7 +1083,7 @@ #else py_code = PyCode_NewEmpty(filename, funcname, py_line); #endif - Py_XDECREF(py_funcname); // XDECREF since it's only set on Py3 if cline + Py_XDECREF(py_funcname); /* XDECREF since it's only set on Py3 if cline */ return py_code; bad: Py_XDECREF(py_funcname); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-3.0.7/Cython/Utility/FunctionArguments.c new/Cython-3.0.8/Cython/Utility/FunctionArguments.c --- old/Cython-3.0.7/Cython/Utility/FunctionArguments.c 2023-12-19 12:00:40.336840000 +0100 +++ new/Cython-3.0.8/Cython/Utility/FunctionArguments.c 2024-01-10 10:54:48.336722100 +0100 @@ -301,7 +301,7 @@ if (*name) { values[name-argnames] = value; #if CYTHON_AVOID_BORROWED_REFS - Py_INCREF(value); // transfer ownership of value to values + Py_INCREF(value); /* transfer ownership of value to values */ Py_DECREF(key); #endif key = NULL; @@ -323,7 +323,7 @@ && _PyString_Eq(**name, key)) { values[name-argnames] = value; #if CYTHON_AVOID_BORROWED_REFS - value = NULL; // ownership transferred to values + value = NULL; /* ownership transferred to values */ #endif break; } @@ -357,7 +357,7 @@ if (cmp == 0) { values[name-argnames] = value; #if CYTHON_AVOID_BORROWED_REFS - value = NULL; // ownership transferred to values + value = NULL; /* ownership transferred to values */ #endif break; } @@ -492,8 +492,8 @@ #define __Pyx_Arg_NewRef_VARARGS(arg) __Pyx_NewRef(arg) #define __Pyx_Arg_XDECREF_VARARGS(arg) Py_XDECREF(arg) #else - #define __Pyx_Arg_NewRef_VARARGS(arg) arg // no-op - #define __Pyx_Arg_XDECREF_VARARGS(arg) // no-op - arg is borrowed + #define __Pyx_Arg_NewRef_VARARGS(arg) arg /* no-op */ + #define __Pyx_Arg_XDECREF_VARARGS(arg) /* no-op - arg is borrowed */ #endif #define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds) #define __Pyx_KwValues_VARARGS(args, nargs) NULL @@ -509,9 +509,9 @@ #else #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw) #endif - #define __Pyx_Arg_NewRef_FASTCALL(arg) arg // no-op, __Pyx_Arg_FASTCALL is direct and this needs - // to have the same reference counting - #define __Pyx_Arg_XDECREF_FASTCALL(arg) // no-op - arg was returned from array + #define __Pyx_Arg_NewRef_FASTCALL(arg) arg /* no-op, __Pyx_Arg_FASTCALL is direct and this needs + to have the same reference counting */ + #define __Pyx_Arg_XDECREF_FASTCALL(arg) /* no-op - arg was returned from array */ #else #define __Pyx_Arg_FASTCALL __Pyx_Arg_VARARGS #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS @@ -555,11 +555,11 @@ { int eq = __Pyx_PyUnicode_Equals(s, PyTuple_GET_ITEM(kwnames, i), Py_EQ); if (unlikely(eq != 0)) { - if (unlikely(eq < 0)) return NULL; // error + if (unlikely(eq < 0)) return NULL; /* error */ return kwvalues[i]; } } - return NULL; // not found (no exception set) + return NULL; /* not found (no exception set) */ } #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-3.0.7/Cython/Utility/ModuleSetupCode.c new/Cython-3.0.8/Cython/Utility/ModuleSetupCode.c --- old/Cython-3.0.7/Cython/Utility/ModuleSetupCode.c 2023-12-19 12:00:40.336840000 +0100 +++ new/Cython-3.0.8/Cython/Utility/ModuleSetupCode.c 2024-01-10 10:54:48.336722100 +0100 @@ -680,7 +680,7 @@ PyObject *exception_table = NULL; PyObject *types_module=NULL, *code_type=NULL, *result=NULL; #if __PYX_LIMITED_VERSION_HEX < 0x030B0000 - PyObject *version_info; // borrowed + PyObject *version_info; /* borrowed */ PyObject *py_minor_version = NULL; #endif long minor_version = 0; @@ -690,8 +690,9 @@ PyErr_Fetch(&type, &value, &traceback); #if __PYX_LIMITED_VERSION_HEX >= 0x030B0000 - minor_version = 11; // we don't yet need to distinguish between versions > 11 - // Note that from 3.13, when we do we can use Py_Version + minor_version = 11; + // we don't yet need to distinguish between versions > 11 + // Note that from 3.13, when we do, we can use Py_Version #else if (!(version_info = PySys_GetObject("version_info"))) goto end; if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end; @@ -772,7 +773,7 @@ // 1. pass an empty bytes string as exception_table // 2. pass name as qualname (TODO this might implementing properly in future) PyCodeObject *result; - PyObject *empty_bytes = PyBytes_FromStringAndSize("", 0); // we don't have access to __pyx_empty_bytes here + PyObject *empty_bytes = PyBytes_FromStringAndSize("", 0); /* we don't have access to __pyx_empty_bytes here */ if (!empty_bytes) return NULL; result = #if PY_VERSION_HEX >= 0x030C0000 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-3.0.7/Cython/Utility/ObjectHandling.c new/Cython-3.0.8/Cython/Utility/ObjectHandling.c --- old/Cython-3.0.7/Cython/Utility/ObjectHandling.c 2023-12-19 12:00:40.336840000 +0100 +++ new/Cython-3.0.8/Cython/Utility/ObjectHandling.c 2024-01-10 10:54:48.336722100 +0100 @@ -241,9 +241,10 @@ // detects an error that occurred in the iterator, it returns -1. static CYTHON_INLINE int __Pyx_IterFinish(void) { + PyObject* exc_type; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign - PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType(); + exc_type = __Pyx_PyErr_CurrentExceptionType(); if (unlikely(exc_type)) { if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) return -1; @@ -1999,10 +2000,11 @@ static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *args, PyObject *kwargs) { // NOTE: possible optimization - use vectorcall + PyObject *result; PyObject *selfless_args = PyTuple_GetSlice(args, 1, PyTuple_Size(args)); if (unlikely(!selfless_args)) return NULL; - PyObject *result = PyObject_Call(method, selfless_args, kwargs); + result = PyObject_Call(method, selfless_args, kwargs); Py_DECREF(selfless_args); return result; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-3.0.7/Cython/Utility/TypeConversion.c new/Cython-3.0.8/Cython/Utility/TypeConversion.c --- old/Cython-3.0.7/Cython/Utility/TypeConversion.c 2023-12-19 12:00:40.336840000 +0100 +++ new/Cython-3.0.8/Cython/Utility/TypeConversion.c 2024-01-10 10:54:48.336722100 +0100 @@ -162,7 +162,7 @@ typedef Py_ssize_t __Pyx_compact_pylong; typedef size_t __Pyx_compact_upylong; - #else // Py < 3.12 + #else /* Py < 3.12 */ #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0) #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0) #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-3.0.7/Cython/Utility/UFuncs_C.c new/Cython-3.0.8/Cython/Utility/UFuncs_C.c --- old/Cython-3.0.7/Cython/Utility/UFuncs_C.c 2023-12-19 12:00:40.336840000 +0100 +++ new/Cython-3.0.8/Cython/Utility/UFuncs_C.c 2024-01-10 10:54:48.336722100 +0100 @@ -19,7 +19,7 @@ // getter functions because we can't forward-declare arrays static PyUFuncGenericFunction* {{ufunc_funcs_name}}(void); /* proto */ static char* {{ufunc_types_name}}(void); /* proto */ -static void* {{ufunc_data_name}}[] = {NULL}; // always null +static void* {{ufunc_data_name}}[] = {NULL}; /* always null */ /////////////////////// UFuncConsts ///////////////////////// diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-3.0.7/PKG-INFO new/Cython-3.0.8/PKG-INFO --- old/Cython-3.0.7/PKG-INFO 2023-12-19 12:00:43.380813400 +0100 +++ new/Cython-3.0.8/PKG-INFO 2024-01-10 10:54:51.236724100 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: Cython -Version: 3.0.7 +Version: 3.0.8 Summary: The Cython compiler for writing C extensions in the Python language. Home-page: https://cython.org/ Author: Robert Bradshaw, Stefan Behnel, Dag Seljebotn, Greg Ewing, et al. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-3.0.7/docs/src/tutorial/pure.rst new/Cython-3.0.8/docs/src/tutorial/pure.rst --- old/Cython-3.0.7/docs/src/tutorial/pure.rst 2023-12-19 12:00:40.360839600 +0100 +++ new/Cython-3.0.8/docs/src/tutorial/pure.rst 2024-01-10 10:54:48.360722300 +0100 @@ -364,6 +364,11 @@ an ``int`` annotation to a C integer by default since the behaviour can be quite different with respect to overflow and division. +Annotations on global variables are currently ignored. This is because we expect +annotation-typed code to be in majority written for Python, and global type annotations +would turn the Python variable into an internal C variable, thus removing it from the +module dict. To declare global variables as typed C variables, use ``@cython.declare()``. + Annotations can be combined with the ``@cython.exceptval()`` decorator for non-Python return types: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-3.0.7/tests/run/fused_types.pyx new/Cython-3.0.8/tests/run/fused_types.pyx --- old/Cython-3.0.7/tests/run/fused_types.pyx 2023-12-19 12:00:40.412839200 +0100 +++ new/Cython-3.0.8/tests/run/fused_types.pyx 2024-01-10 10:54:48.408722200 +0100 @@ -24,6 +24,14 @@ fused_composite = cython.fused_type(fused_type2, fused_type3) just_float = cython.fused_type(float) +ctypedef int inttypedef +ctypedef double doubletypedef +fused_with_typedef = cython.fused_type(inttypedef, doubletypedef) + +ctypedef float const_inttypedef # misleading name +fused_misleading_name = cython.fused_type(const_inttypedef, char) + + def test_pure(): """ >>> test_pure() @@ -553,6 +561,26 @@ elif cython.floating is double: return handle_double(&x) +def constfused_with_typedef(const fused_with_typedef[:] x): + """ + >>> constfused_with_typedef(get_array(8, 'd')) + 5.0 + >>> constfused_with_typedef(get_intc_array()) + 5 + """ + return x[5] + +def constfused_typedef_name_clashes(const fused_with_typedef[:] x, fused_misleading_name[:] y): + """ + This'll deliberately end up with two typedefs that generate the same name in dispatch code + (and thus one needs to end up numbered to make it work). + It's mainly a compile test and the runtime part is fairly token. + + >>> constfused_typedef_name_clashes(get_intc_array(), get_array(4, 'f')) + (5, 5.0) + """ + return x[5], y[5] + cdef double get_double(): return 1.0 cdef float get_float():