Compare commits

1 Commits
1.1 ... main

5 changed files with 598 additions and 24 deletions

BIN
Cython-0.29.36.tar.gz (Stored with Git LFS)

Binary file not shown.

BIN
Cython-0.29.37.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

535
py313.patch Normal file
View File

@@ -0,0 +1,535 @@
Index: Cython-0.29.37/Cython/Compiler/ModuleNode.py
===================================================================
--- Cython-0.29.37.orig/Cython/Compiler/ModuleNode.py
+++ Cython-0.29.37/Cython/Compiler/ModuleNode.py
@@ -2825,15 +2825,13 @@ class ModuleNode(Nodes.Node, Nodes.Block
code.put_incref(env.module_dict_cname, py_object_type, nanny=False)
code.putln(
- '%s = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); %s' % (
+ '%s = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); %s' % (
Naming.builtins_cname,
code.error_goto_if_null(Naming.builtins_cname, self.pos)))
- code.put_incref(Naming.builtins_cname, py_object_type, nanny=False)
code.putln(
- '%s = PyImport_AddModule((char *) "cython_runtime"); %s' % (
+ '%s = __Pyx_PyImport_AddModuleRef((const char *) "cython_runtime"); %s' % (
Naming.cython_runtime_cname,
code.error_goto_if_null(Naming.cython_runtime_cname, self.pos)))
- code.put_incref(Naming.cython_runtime_cname, py_object_type, nanny=False)
code.putln(
'if (PyObject_SetAttrString(%s, "__builtins__", %s) < 0) %s' % (
env.module_cname,
@@ -2841,11 +2839,10 @@ class ModuleNode(Nodes.Node, Nodes.Block
code.error_goto(self.pos)))
if Options.pre_import is not None:
code.putln(
- '%s = PyImport_AddModule("%s"); %s' % (
+ '%s = __Pyx_PyImport_AddModuleRef("%s"); %s' % (
Naming.preimport_cname,
Options.pre_import,
code.error_goto_if_null(Naming.preimport_cname, self.pos)))
- code.put_incref(Naming.preimport_cname, py_object_type, nanny=False)
def generate_global_init_code(self, env, code):
# Generate code to initialise global PyObject *
Index: Cython-0.29.37/Cython/Utility/Builtins.c
===================================================================
--- Cython-0.29.37.orig/Cython/Utility/Builtins.c
+++ Cython-0.29.37/Cython/Utility/Builtins.c
@@ -175,6 +175,7 @@ static CYTHON_INLINE PyObject *__Pyx_Get
//@requires: Exceptions.c::PyErrFetchRestore
//@requires: Exceptions.c::PyErrExceptionMatches
+#if __PYX_LIMITED_VERSION_HEX < 0x030d00A1
static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
__Pyx_PyThreadState_declare
__Pyx_PyThreadState_assign
@@ -184,19 +185,31 @@ static PyObject *__Pyx_GetAttr3Default(P
Py_INCREF(d);
return d;
}
+#endif
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
PyObject *r = __Pyx_GetAttr(o, n);
+#if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1
+ int res = PyObject_GetOptionalAttr(o, n, &r);
+ // On failure (res == -1), r is set to NULL.
+ return (res != 0) ? r : __Pyx_NewRef(d);
+#else
return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
+#endif
}
//////////////////// HasAttr.proto ////////////////////
+#if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1
+#define __Pyx_HasAttr(o, n) PyObject_HasAttrWithError(o, n)
+#else
static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); /*proto*/
+#endif
//////////////////// HasAttr ////////////////////
//@requires: ObjectHandling.c::GetAttr
+#if __PYX_LIMITED_VERSION_HEX < 0x030d00A1
static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
PyObject *r;
if (unlikely(!__Pyx_PyBaseString_Check(n))) {
@@ -213,6 +226,7 @@ static CYTHON_INLINE int __Pyx_HasAttr(P
return 1;
}
}
+#endif
//////////////////// Intern.proto ////////////////////
@@ -278,7 +292,7 @@ static PyObject *__Pyx_PyLong_AbsNeg(PyO
// digits are unsigned
return PyLong_FromLong(((PyLongObject*)n)->ob_digit[0]);
}
-#if CYTHON_COMPILING_IN_CPYTHON
+#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
{
PyObject *copy = _PyLong_Copy((PyLongObject*)n);
if (likely(copy)) {
Index: Cython-0.29.37/Cython/Utility/Coroutine.c
===================================================================
--- Cython-0.29.37.orig/Cython/Utility/Coroutine.c
+++ Cython-0.29.37/Cython/Utility/Coroutine.c
@@ -135,7 +135,7 @@ static CYTHON_INLINE PyObject *__Pyx_Cor
static void __Pyx_Coroutine_AwaitableIterError(PyObject *source) {
-#if PY_VERSION_HEX >= 0x030600B3 || defined(_PyErr_FormatFromCause)
+#if PY_VERSION_HEX >= 0x030600B3 && PY_VERSION_HEX < 0x030d0000 || defined(_PyErr_FormatFromCause)
_PyErr_FormatFromCause(
PyExc_TypeError,
"'async for' received an invalid object "
@@ -166,7 +166,7 @@ static void __Pyx_Coroutine_AwaitableIte
PyErr_Restore(exc, val2, tb);
#else
// since Py2 does not have exception chaining, it's better to avoid shadowing exceptions there
- source++;
+ CYTHON_UNUSED_VAR(source);
#endif
}
@@ -489,6 +489,7 @@ static int __pyx_Generator_init(void); /
//@requires: Exceptions.c::RaiseException
//@requires: Exceptions.c::SaveResetException
//@requires: ObjectHandling.c::PyObjectCallMethod1
+//@requires: ObjectHandling.c::PyObjectCallOneArg
//@requires: ObjectHandling.c::PyObjectGetAttrStr
//@requires: CommonStructures.c::FetchCommonType
@@ -822,9 +823,23 @@ PyObject *__Pyx_PyGen_Send(PyGenObject *
PyErr_SetNone(PyExc_StopIteration);
}
else {
+#if PY_VERSION_HEX < 0x030d00A1
_PyGen_SetStopIterationValue(result);
+#else
+ if (!PyTuple_Check(result) && !PyExceptionInstance_Check(result)) {
+ // delay instantiation if possible
+ PyErr_SetObject(PyExc_StopIteration, result);
+ } else {
+ PyObject *exc = __Pyx_PyObject_CallOneArg(PyExc_StopIteration, result);
+ if (likely(exc != NULL)) {
+ PyErr_SetObject(PyExc_StopIteration, exc);
+ Py_DECREF(exc);
+ }
+ }
+#endif
}
- Py_CLEAR(result);
+ Py_DECREF(result);
+ result = NULL;
}
return result;
#endif
Index: Cython-0.29.37/Cython/Utility/Exceptions.c
===================================================================
--- Cython-0.29.37.orig/Cython/Utility/Exceptions.c
+++ Cython-0.29.37/Cython/Utility/Exceptions.c
@@ -17,7 +17,7 @@ __Pyx_init_assertions_enabled();
#define __pyx_assertions_enabled() (1)
#elif PY_VERSION_HEX < 0x03080000 || CYTHON_COMPILING_IN_PYPY || defined(Py_LIMITED_API)
#define __pyx_assertions_enabled() (!Py_OptimizeFlag)
-#elif CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030900A6
+#elif CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030900A6 && PY_VERSION_HEX < 0x030d0000
// Py3.8+ has PyConfig from PEP 587, but only Py3.9 added read access to it.
// Py_OptimizeFlag is deprecated in Py3.12+
static int __pyx_assertions_enabled_flag;
@@ -401,6 +401,8 @@ static int __Pyx_GetException(PyObject *
if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
goto bad;
}
+ #else
+ return NULL;
#endif
// traceback may be NULL for freshly raised exceptions
Py_XINCREF(local_tb);
Index: Cython-0.29.37/Cython/Utility/ImportExport.c
===================================================================
--- Cython-0.29.37.orig/Cython/Utility/ImportExport.c
+++ Cython-0.29.37/Cython/Utility/ImportExport.c
@@ -233,7 +233,6 @@ static int __Pyx_SetPackagePathFromImpor
#endif
/////////////// SetPackagePathFromImportLib ///////////////
-//@requires: ObjectHandling.c::PyObjectGetAttrStr
//@substitute: naming
// PY_VERSION_HEX >= 0x03030000
Index: Cython-0.29.37/Cython/Utility/ModuleSetupCode.c
===================================================================
--- Cython-0.29.37.orig/Cython/Utility/ModuleSetupCode.c
+++ Cython-0.29.37/Cython/Utility/ModuleSetupCode.c
@@ -604,6 +604,10 @@ class __Pyx_FakeReference {
#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
#define __Pyx_PyThreadState_Current PyThreadState_GET()
+#elif PY_VERSION_HEX >= 0x030d00A1
+ //#elif PY_VERSION_HEX >= 0x03050200
+ // Actually added in 3.5.2, but compiling against that does not guarantee that we get imported there.
+ #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked()
#elif PY_VERSION_HEX >= 0x03060000
//#elif PY_VERSION_HEX >= 0x03050200
// Actually added in 3.5.2, but compiling against that does not guarantee that we get imported there.
@@ -648,7 +652,7 @@ static CYTHON_INLINE void * PyThread_tss
// PyThread_ReInitTLS() is a no-op
#endif /* TSS (Thread Specific Storage) API */
-#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
+#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000 || defined(_PyDict_NewPresized)
#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
#else
#define __Pyx_PyDict_NewPresized(n) PyDict_New()
@@ -662,7 +666,7 @@ static CYTHON_INLINE void * PyThread_tss
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
#endif
-#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
+#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && PY_VERSION_HEX < 0x030d0000 && CYTHON_USE_UNICODE_INTERNALS
#define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
#else
#define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
@@ -790,6 +794,16 @@ static CYTHON_INLINE void * PyThread_tss
#define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
#endif
+#if PY_VERSION_HEX >= 0x030d00A1
+ #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
+#else
+ static CYTHON_INLINE PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
+ PyObject *module = PyImport_AddModule(name);
+ Py_XINCREF(module);
+ return module;
+ }
+#endif
+
#if PY_MAJOR_VERSION >= 3
#define PyIntObject PyLongObject
#define PyInt_Type PyLong_Type
@@ -1667,9 +1681,12 @@ static void __Pyx_FastGilFuncInit0(void)
__Pyx_FastGIL_Remember = __Pyx_FastGIL_Remember0;
__Pyx_FastGIL_Forget = __Pyx_FastGIL_Forget0;
capsule = PyCapsule_New(&__Pyx_FastGilFuncs, __Pyx_FastGIL_PyCapsule, NULL);
- abi_module = PyImport_AddModule(__Pyx_FastGIL_ABI_module);
- if (capsule && abi_module) {
- PyObject_SetAttrString(abi_module, __Pyx_FastGIL_PyCapsuleName, capsule);
+ if (capsule) {
+ abi_module = __Pyx_PyImport_AddModuleRef(__Pyx_FastGIL_ABI_module);
+ if (abi_module) {
+ PyObject_SetAttrString(abi_module, __Pyx_FastGIL_PyCapsuleName, capsule);
+ Py_DECREF(abi_module);
+ }
}
Py_XDECREF(capsule);
}
Index: Cython-0.29.37/Cython/Utility/ObjectHandling.c
===================================================================
--- Cython-0.29.37.orig/Cython/Utility/ObjectHandling.c
+++ Cython-0.29.37/Cython/Utility/ObjectHandling.c
@@ -198,7 +198,7 @@ static CYTHON_INLINE PyObject *__Pyx_PyI
next = iternext(iterator);
if (likely(next))
return next;
- #if PY_VERSION_HEX >= 0x02070000 && CYTHON_COMPILING_IN_CPYTHON
+ #if PY_VERSION_HEX >= 0x02070000 && PY_VERSION_HEX < 0x030d0000 && CYTHON_COMPILING_IN_CPYTHON
if (unlikely(iternext == &_PyObject_NextNotImplemented))
return NULL;
#endif
@@ -1151,7 +1151,7 @@ static PyObject *__Pyx__GetNameInClass(P
/////////////// SetNameInClass.proto ///////////////
-#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
+#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && PY_VERSION_HEX < 0x030d0000
// Identifier names are always interned and have a pre-calculated hash value.
#define __Pyx_SetNameInClass(ns, name, value) \
(likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value))
@@ -1200,7 +1200,7 @@ static CYTHON_INLINE PyObject *__Pyx__Ge
{
PyObject *result;
#if !CYTHON_AVOID_BORROWED_REFS
-#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
+#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && PY_VERSION_HEX < 0x030d0000
// Identifier names are always interned and have a pre-calculated hash value.
result = _PyDict_GetItem_KnownHash($moddict_cname, name, ((PyASCIIObject *) name)->hash);
__PYX_UPDATE_DICT_CACHE($moddict_cname, result, *dict_cached_value, *dict_version)
@@ -1370,15 +1370,21 @@ static CYTHON_INLINE PyObject* __Pyx_PyO
//@requires: Exceptions.c::PyErrFetchRestore
//@requires: Exceptions.c::PyErrExceptionMatches
+#if __PYX_LIMITED_VERSION_HEX < 0x030d00A1
static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
__Pyx_PyThreadState_declare
__Pyx_PyThreadState_assign
if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
__Pyx_PyErr_Clear();
}
+#endif
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
PyObject *result;
+#if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1
+ (void) PyObject_GetOptionalAttr(obj, attr_name, &result);
+ return result;
+#else
#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
// _PyObject_GenericGetAttrWithDict() in CPython 3.7+ can avoid raising the AttributeError.
// See https://bugs.python.org/issue32544
@@ -1392,6 +1398,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyO
__Pyx_PyObject_GetAttrStr_ClearAttributeError();
}
return result;
+#endif
}
@@ -1818,14 +1825,24 @@ static PyObject* __Pyx_PyObject_CallMeth
//@requires: PyObjectCallOneArg
//@requires: PyObjectCall2Args
+#if !(CYTHON_VECTORCALL && __PYX_LIMITED_VERSION_HEX >= 0x030C00A2)
static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
// Separate function to avoid excessive inlining.
PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
Py_DECREF(method);
return result;
}
+#endif
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
+#if CYTHON_VECTORCALL && __PYX_LIMITED_VERSION_HEX >= 0x030C00A2
+ PyObject *args[2] = {obj, arg};
+ // avoid unused functions
+ (void) __Pyx_PyObject_GetMethod;
+ (void) __Pyx_PyObject_CallOneArg;
+ (void) __Pyx_PyObject_Call2Args;
+ return PyObject_VectorcallMethod(method_name, args, 2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
+#else
PyObject *method = NULL, *result;
int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
if (likely(is_method)) {
@@ -1835,6 +1852,7 @@ static PyObject* __Pyx_PyObject_CallMeth
}
if (unlikely(!method)) return NULL;
return __Pyx__PyObject_CallMethod1(method, arg);
+#endif
}
Index: Cython-0.29.37/Cython/Utility/Optimize.c
===================================================================
--- Cython-0.29.37.orig/Cython/Utility/Optimize.c
+++ Cython-0.29.37/Cython/Utility/Optimize.c
@@ -34,7 +34,14 @@ static CYTHON_INLINE int __Pyx_PyList_Ap
Py_ssize_t len = Py_SIZE(list);
if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
Py_INCREF(x);
+ #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
+ // In Py3.13a1, PyList_SET_ITEM() checks that the end index is lower than the current size.
+ // However, extending the size *before* setting the value would not be correct,
+ // so we cannot call PyList_SET_ITEM().
+ L->ob_item[len] = x;
+ #else
PyList_SET_ITEM(list, len, x);
+ #endif
__Pyx_SET_SIZE(list, len + 1);
return 0;
}
@@ -52,7 +59,14 @@ static CYTHON_INLINE int __Pyx_ListComp_
Py_ssize_t len = Py_SIZE(list);
if (likely(L->allocated > len)) {
Py_INCREF(x);
+ #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
+ // In Py3.13a1, PyList_SET_ITEM() checks that the end index is lower than the current size.
+ // However, extending the size *before* setting the value would not be correct,
+ // so we cannot call PyList_SET_ITEM().
+ L->ob_item[len] = x;
+ #else
PyList_SET_ITEM(list, len, x);
+ #endif
__Pyx_SET_SIZE(list, len + 1);
return 0;
}
@@ -65,7 +79,7 @@ static CYTHON_INLINE int __Pyx_ListComp_
//////////////////// ListExtend.proto ////////////////////
static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
-#if CYTHON_COMPILING_IN_CPYTHON
+#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
PyObject* none = _PyList_Extend((PyListObject*)L, v);
if (unlikely(!none))
return -1;
@@ -279,7 +293,7 @@ static CYTHON_INLINE PyObject *__Pyx_PyD
/////////////// py_dict_pop ///////////////
static CYTHON_INLINE PyObject *__Pyx_PyDict_Pop(PyObject *d, PyObject *key, PyObject *default_value) {
-#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B3
+#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B3 & PY_VERSION_HEX < 0x030d0000
if ((1)) {
return _PyDict_Pop(d, key, default_value);
} else
@@ -435,7 +449,7 @@ static CYTHON_INLINE int __Pyx_set_iter_
static CYTHON_INLINE PyObject* __Pyx_set_iterator(PyObject* iterable, int is_set,
Py_ssize_t* p_orig_length, int* p_source_is_set) {
-#if CYTHON_COMPILING_IN_CPYTHON
+#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
is_set = is_set || likely(PySet_CheckExact(iterable) || PyFrozenSet_CheckExact(iterable));
*p_source_is_set = is_set;
if (likely(is_set)) {
@@ -455,7 +469,7 @@ static CYTHON_INLINE int __Pyx_set_iter_
PyObject* iter_obj, Py_ssize_t orig_length,
Py_ssize_t* ppos, PyObject **value,
int source_is_set) {
- if (!CYTHON_COMPILING_IN_CPYTHON || unlikely(!source_is_set)) {
+ if (!CYTHON_COMPILING_IN_CPYTHON || PY_VERSION_HEX >= 0x030d0000 || unlikely(!source_is_set)) {
*value = PyIter_Next(iter_obj);
if (unlikely(!*value)) {
return __Pyx_IterFinish();
@@ -464,7 +478,7 @@ static CYTHON_INLINE int __Pyx_set_iter_
(void)ppos;
return 1;
}
-#if CYTHON_COMPILING_IN_CPYTHON
+#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
if (unlikely(PySet_GET_SIZE(iter_obj) != orig_length)) {
PyErr_SetString(
PyExc_RuntimeError,
Index: Cython-0.29.37/Cython/Utility/StringTools.c
===================================================================
--- Cython-0.29.37.orig/Cython/Utility/StringTools.c
+++ Cython-0.29.37/Cython/Utility/StringTools.c
@@ -804,25 +804,22 @@ static CYTHON_INLINE char __Pyx_PyBytes_
#define __Pyx_PyString_Join PyUnicode_Join
#define __Pyx_PyBaseString_Join PyUnicode_Join
#endif
-
-#if CYTHON_COMPILING_IN_CPYTHON
- #if PY_MAJOR_VERSION < 3
- #define __Pyx_PyBytes_Join _PyString_Join
- #else
- #define __Pyx_PyBytes_Join _PyBytes_Join
- #endif
-#else
static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values); /*proto*/
-#endif
-
//////////////////// StringJoin ////////////////////
+//@requires: ObjectHandling.c::PyObjectCallMethod1
-#if !CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) {
- return PyObject_CallMethodObjArgs(sep, PYIDENT("join"), values, NULL);
-}
+ // avoid unused function
+ (void) __Pyx_PyObject_CallMethod1;
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION < 3
+ return _PyString_Join(sep, values);
+#elif CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
+ return _PyBytes_Join(sep, values);
+#else
+ return __Pyx_PyObject_CallMethod1(sep, PYIDENT("join"), values);
#endif
+}
/////////////// JoinPyUnicode.proto ///////////////
@@ -873,8 +870,8 @@ static PyObject* __Pyx_PyUnicode_Join(Py
if (!CYTHON_PEP393_ENABLED || ukind == result_ukind) {
memcpy((char *)result_udata + char_pos * result_ukind, udata, (size_t) (ulength * result_ukind));
} else {
- #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030300F0 || defined(_PyUnicode_FastCopyCharacters)
- _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength);
+ #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030300F0 || defined(_PyUnicode_CopyCharacters)
+ PyUnicode_CopyCharacters(result_uval, char_pos, uval, 0, ulength);
#else
Py_ssize_t j;
for (j=0; j < ulength; j++) {
Index: Cython-0.29.37/Cython/Utility/TypeConversion.c
===================================================================
--- Cython-0.29.37.orig/Cython/Utility/TypeConversion.c
+++ Cython-0.29.37/Cython/Utility/TypeConversion.c
@@ -679,8 +679,23 @@ static CYTHON_INLINE PyObject* {{TO_PY_F
{
int one = 1; int little = (int)*(unsigned char *)&one;
unsigned char *bytes = (unsigned char *)&value;
+#if PY_VERSION_HEX < 0x030d0000
return _PyLong_FromByteArray(bytes, sizeof({{TYPE}}),
little, !is_unsigned);
+#else
+ PyObject *from_bytes, *result = NULL, *kwds = NULL;
+ PyObject *py_bytes = NULL, *arg_tuple = NULL, *order_str = NULL;
+ from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
+ if (!from_bytes) return NULL;
+ py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof({{TYPE}}));
+ order_str = PyUnicode_FromString(little ? "little" : "big");
+ arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
+ if (!is_unsigned) {
+ // default is signed=False
+ kwds = PyDict_New();
+ }
+ result = PyObject_Call(from_bytes, arg_tuple, kwds);
+#endif
}
}
@@ -984,6 +999,7 @@ static CYTHON_INLINE {{TYPE}} {{FROM_PY_
}
#endif
if (likely(v)) {
+#if PY_VERSION_HEX < 0x030d0000
int one = 1; int is_little = (int)*(unsigned char *)&one;
unsigned char *bytes = (unsigned char *)&val;
int ret = _PyLong_AsByteArray((PyLongObject *)v,
@@ -992,6 +1008,7 @@ static CYTHON_INLINE {{TYPE}} {{FROM_PY_
Py_DECREF(v);
if (likely(!ret))
return val;
+#endif
}
#endif
return ({{TYPE}}) -1;
Index: Cython-0.29.37/tests/run/set_iter.pyx
===================================================================
--- Cython-0.29.37.orig/tests/run/set_iter.pyx
+++ Cython-0.29.37/tests/run/set_iter.pyx
@@ -65,9 +65,9 @@ def set_iter_modify(set s, int value):
[1, 2, 3]
>>> sorted(set_iter_modify(s, 3))
[1, 2, 3]
- >>> sorted(set_iter_modify(s, 4))
+ >>> sorted(set_iter_modify(s, 4)) # doctest: +ELLIPSIS
Traceback (most recent call last):
- RuntimeError: set changed size during iteration
+ RuntimeError: ...et changed size during iteration
"""
for x in s:
s.add(value)

View File

@@ -1,3 +1,39 @@
-------------------------------------------------------------------
Tue Apr 1 11:48:56 UTC 2025 - Markéta Machová <mmachova@suse.com>
- Make the dist-info name case-insensitive
-------------------------------------------------------------------
Tue Mar 25 01:19:44 UTC 2025 - Steve Kowalik <steven.kowalik@suse.com>
- Lowercase metadata directory name.
-------------------------------------------------------------------
Fri Oct 18 08:06:19 UTC 2024 - Markéta Machová <mmachova@suse.com>
- Add py313.patch to adapt Cython0 to Python 3.13
-------------------------------------------------------------------
Sun Feb 4 15:27:06 UTC 2024 - Frank Schreiner <FSchreiner@suse.com>
- update to version 0.29.37
* Fix a potential crash while cleaning up subtypes of externally
imported extension types when terminating Python.
This was introduced in Cython 0.29.35.
* Fix a ``complex`` related compile error on Windows.
(Github issue :issue:`5512`)
* Compiling fused types used in pxd files could crash Cython in
Python 3.11+. (Github issues :issue:`5894`, :issue:`5588`)
* ``cythonize`` failed to consider the ``CYTHON_FORCE_REGEN`` env variable.
Patch by Harmen Stoppels. (Github issue :issue:`5712`)
-------------------------------------------------------------------
Tue Jan 2 22:01:37 UTC 2024 - Dirk Müller <dmueller@suse.com>
- require setuptools
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Jul 10 19:03:16 UTC 2023 - Matej Cepl <mcepl@suse.com> Mon Jul 10 19:03:16 UTC 2023 - Matej Cepl <mcepl@suse.com>
@@ -55,7 +91,7 @@ Mon Apr 3 19:58:40 UTC 2023 - Dirk Müller <dmueller@suse.com>
- update to 0.29.34: - update to 0.29.34:
* A refence leak of the for-loop list/tuple iterable was * A refence leak of the for-loop list/tuple iterable was
resolved if the for-loop's ``else:`` branch executes resolved if the for-loop's ``else:`` branch executes
a ``break`` for an outer loop. a ``break`` for an outer loop.
* Some C compile failures in CPython 3.12 were resolved. * Some C compile failures in CPython 3.12 were resolved.
* Some old usages of the deprecated Python ``imp`` module were * Some old usages of the deprecated Python ``imp`` module were
@@ -72,7 +108,7 @@ Sat Jan 7 12:27:04 UTC 2023 - Dirk Müller <dmueller@suse.com>
* The ``cythonize`` and ``cython`` commands have a new option ``-M`` / * The ``cythonize`` and ``cython`` commands have a new option ``-M`` /
``--depfile`` to generate ``.dep`` dependency files for the ``--depfile`` to generate ``.dep`` dependency files for the
compilation unit. This can be used by external build tools to compilation unit. This can be used by external build tools to
track these dependencies. track these dependencies.
* ``const`` fused types could not be used with memory views. * ``const`` fused types could not be used with memory views.
* ``wstr`` usage was removed in Python 3.12 and later (PEP-623). * ``wstr`` usage was removed in Python 3.12 and later (PEP-623).
* A type check assertion for Cython functions failed in debug Python * A type check assertion for Cython functions failed in debug Python
@@ -145,7 +181,7 @@ Wed May 18 08:35:39 UTC 2022 - Paolo Stivanin <info@paolostivanin.com>
- update to 0.29.30: - update to 0.29.30:
* Avoid acquiring the GIL at the end of nogil functions. This change * Avoid acquiring the GIL at the end of nogil functions. This change
was backported in order to avoid generating wrong C code that was backported in order to avoid generating wrong C code that
would trigger C compiler warnings with tracing support enabled. would trigger C compiler warnings with tracing support enabled.
* Function definitions in finally: clauses were not correctly generated. * Function definitions in finally: clauses were not correctly generated.
* A case where C-API functions could be called with a live exception * A case where C-API functions could be called with a live exception
set was fixed. set was fixed.
@@ -227,7 +263,7 @@ Wed Jul 14 08:28:08 UTC 2021 - Paolo Stivanin <info@paolostivanin.com>
* The attributes ``gen.gi_frame`` and ``coro.cr_frame`` of Cython compiled * The attributes ``gen.gi_frame`` and ``coro.cr_frame`` of Cython compiled
generators and coroutines now return an actual frame object for introspection, generators and coroutines now return an actual frame object for introspection,
instead of ``None``. instead of ``None``.
- Drop cython_use_imgmath.patch - Drop cython_use_imgmath.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Apr 21 21:19:17 UTC 2021 - Dirk Müller <dmueller@suse.com> Wed Apr 21 21:19:17 UTC 2021 - Dirk Müller <dmueller@suse.com>
@@ -246,7 +282,7 @@ Wed Apr 21 21:19:17 UTC 2021 - Dirk Müller <dmueller@suse.com>
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Feb 23 07:22:13 UTC 2021 - Paolo Stivanin <info@paolostivanin.com> Tue Feb 23 07:22:13 UTC 2021 - Paolo Stivanin <info@paolostivanin.com>
- Update to 0.29.22 - Update to 0.29.22
* Some declarations were added to the provided pxd includes. * Some declarations were added to the provided pxd includes.
Patches by Zackery Spytz and John Kirkham. Patches by Zackery Spytz and John Kirkham.
(Github issues #3811, #3882, #3899, #3901) (Github issues #3811, #3882, #3899, #3901)
@@ -483,8 +519,8 @@ Mon Jun 3 13:37:55 UTC 2019 - Ondřej Súkup <mimi.vx@gmail.com>
- update to 0.29.10 - update to 0.29.10
* Fix compile errors in CPython 3.8b1 due to the new "tp_vectorcall" slots. * Fix compile errors in CPython 3.8b1 due to the new "tp_vectorcall" slots.
* Remove an incorrect cast when using true-division in C++ operations. * Remove an incorrect cast when using true-division in C++ operations.
* C compile errors with CPython 3.8 were resolved. * C compile errors with CPython 3.8 were resolved.
* Python tuple constants that compare equal but have different item types * Python tuple constants that compare equal but have different item types
could incorrectly be merged into a single constant. could incorrectly be merged into a single constant.
* Non-ASCII characters in unprefixed strings could crash the compiler * Non-ASCII characters in unprefixed strings could crash the compiler
@@ -566,7 +602,7 @@ Sun Jan 20 04:34:42 UTC 2019 - Arun Persaud <arun@gmx.de>
Thu Dec 6 09:45:54 UTC 2018 - ncutler@suse.com Thu Dec 6 09:45:54 UTC 2018 - ncutler@suse.com
- revert to version 0.28.5 to restore support for subinterpreters - revert to version 0.28.5 to restore support for subinterpreters
needed by Ceph - stopgap measure until issue can be addressed needed by Ceph - stopgap measure until issue can be addressed
upstream (bsc#1118611) upstream (bsc#1118611)
------------------------------------------------------------------- -------------------------------------------------------------------
@@ -1308,7 +1344,7 @@ Fri Jul 10 21:59:38 UTC 2015 - termim@gmail.com
checks were not propagated. checks were not propagated.
* Runtime reported file paths of source files (e.g for profiling * Runtime reported file paths of source files (e.g for profiling
and tracing) are now relative to the build root directory instead and tracing) are now relative to the build root directory instead
of the main source file. of the main source file.
* Tracing exception handling code could enter the trace function with an * Tracing exception handling code could enter the trace function with an
active exception set. active exception set.
* The internal generator function type was not shared across modules. * The internal generator function type was not shared across modules.
@@ -1400,7 +1436,7 @@ Thu Jan 8 12:22:10 UTC 2015 - dimstar@opensuse.org
Thu Dec 18 10:48:28 UTC 2014 - p.drouand@gmail.com Thu Dec 18 10:48:28 UTC 2014 - p.drouand@gmail.com
- Improve update-alternatives. - Improve update-alternatives.
- Remove Cython-fix-version-detection.patch - Remove Cython-fix-version-detection.patch
(got fixed upstream) (got fixed upstream)
- update to version 0.21.1: - update to version 0.21.1:
* Features added * Features added
@@ -1443,11 +1479,11 @@ Fri Sep 12 10:52:18 UTC 2014 - toddrme2178@gmail.com
- Add Cython-fix-version-detection.patch - Add Cython-fix-version-detection.patch
This is a patch from upstream that restores version information This is a patch from upstream that restores version information
whose removal is preventing several packages from correctly whose removal is preventing several packages from correctly
detecting Cython's presence. It is already merged upstream and detecting Cython's presence. It is already merged upstream and
so should be in the next release. so should be in the next release.
Note that despite what upstream says, Note that despite what upstream says,
python-tables/python3-tables is NOT the only package affected by python-tables/python3-tables is NOT the only package affected by
this, which is why the patch is going here instead of this, which is why the patch is going here instead of
python-tables/python3-tables. python-tables/python3-tables.
python-bcolz/python3-bcolz is an example of another package python-bcolz/python3-bcolz is an example of another package
affected. affected.
@@ -1550,7 +1586,7 @@ Thu Sep 11 09:30:20 UTC 2014 - toddrme2178@gmail.com
* Removed support for CPython 2.4, 2.5 and 3.1. * Removed support for CPython 2.4, 2.5 and 3.1.
* The licensing implications on the generated code were clarified * The licensing implications on the generated code were clarified
to avoid legal constraints for users. to avoid legal constraints for users.
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Jul 31 16:26:07 UTC 2014 - dimstar@opensuse.org Thu Jul 31 16:26:07 UTC 2014 - dimstar@opensuse.org
@@ -1774,11 +1810,11 @@ Fri Sep 2 11:03:40 UTC 2011 - saschpe@suse.de
Fri Sep 2 09:50:25 UTC 2011 - saschpe@suse.de Fri Sep 2 09:50:25 UTC 2011 - saschpe@suse.de
- Update to version 0.15: - Update to version 0.15:
* For loop docs fix and pointer iteration. * For loop docs fix and pointer iteration.
* Pure decorators now implemented. * Pure decorators now implemented.
* fix bug #707: optimised dict iteration over non-trivial expressions fail... * fix bug #707: optimised dict iteration over non-trivial expressions fail...
* optimise object.pop() for sets * optimise object.pop() for sets
* Py2.4 fix: PySet_Pop() appeared in Py2.5 * Py2.4 fix: PySet_Pop() appeared in Py2.5
* Py3.3 test fix * Py3.3 test fix
* Support module level control flow and Entry-level error on uninitialized * Support module level control flow and Entry-level error on uninitialized
- Spec file cleanup: - Spec file cleanup:

View File

@@ -1,7 +1,7 @@
# #
# spec file for package python-Cython0 # spec file for package python-Cython0
# #
# Copyright (c) 2023 SUSE LLC # Copyright (c) 2025 SUSE LLC
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@@ -19,15 +19,18 @@
%{?sle15_python_module_pythons} %{?sle15_python_module_pythons}
%bcond_with test %bcond_with test
Name: python-Cython0 Name: python-Cython0
Version: 0.29.36 Version: 0.29.37
Release: 0 Release: 0
Summary: The Cython compiler for writing C extensions for the Python language Summary: The Cython compiler for writing C extensions for the Python language
License: Apache-2.0 License: Apache-2.0
URL: https://cython.org/ URL: https://cython.org/
Source: https://files.pythonhosted.org/packages/source/C/Cython/Cython-%{version}.tar.gz Source: https://files.pythonhosted.org/packages/source/C/Cython/Cython-%{version}.tar.gz
Source1: python-Cython0-rpmlintrc Source1: python-Cython0-rpmlintrc
# PATCH-FIX-UPSTREAM backported https://github.com/cython/cython/pull/5767 Adapt to C-API changes in CPython 3.13
Patch0: py313.patch
BuildRequires: %{python_module devel} BuildRequires: %{python_module devel}
BuildRequires: %{python_module pip} BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel} BuildRequires: %{python_module wheel}
BuildRequires: %{python_module xml} BuildRequires: %{python_module xml}
BuildRequires: fdupes BuildRequires: fdupes
@@ -38,7 +41,7 @@ Provides: python-cython = %{version}-%{release}
Requires: python-devel Requires: python-devel
Requires: python-xml Requires: python-xml
Requires(post): update-alternatives Requires(post): update-alternatives
Requires(postun):update-alternatives Requires(postun): update-alternatives
%python_subpackages %python_subpackages
%description %description
@@ -52,7 +55,7 @@ functions and declaring C types on variables and class attributes. This
allows the compiler to generate very efficient C code from Cython code. allows the compiler to generate very efficient C code from Cython code.
%prep %prep
%setup -q -n Cython-%{version} %autosetup -p1 -n Cython-%{version}
# Fix non-executable scripts # Fix non-executable scripts
sed -i "s|^#!.*||" Cython/Debugger/{libpython,Cygdb}.py cython.py sed -i "s|^#!.*||" Cython/Debugger/{libpython,Cygdb}.py cython.py
@@ -93,7 +96,7 @@ $python runtests.py -v
%python_alternative %{_bindir}/cython %python_alternative %{_bindir}/cython
%python_alternative %{_bindir}/cythonize %python_alternative %{_bindir}/cythonize
%{python_sitearch}/Cython/ %{python_sitearch}/Cython/
%{python_sitearch}/Cython-%{version}*-info %{python_sitearch}/[cC]ython-%{version}*-info
%{python_sitearch}/cython.py* %{python_sitearch}/cython.py*
%pycache_only %{python_sitearch}/__pycache__/cython*.py* %pycache_only %{python_sitearch}/__pycache__/cython*.py*
%{python_sitearch}/pyximport/ %{python_sitearch}/pyximport/