Update to 0.29.24 to fix FTBFS with Python 3.10

This commit is contained in:
Scott Talbert 2021-07-22 11:26:10 -04:00
parent 1ee3b1a90c
commit d5f7a019c7
6 changed files with 32 additions and 241 deletions

1
.gitignore vendored
View File

@ -46,3 +46,4 @@ Cython-0.12.1.tar.gz
/Cython-0.29.19.tar.gz
/Cython-0.29.21.tar.gz
/Cython-0.29.22.tar.gz
/Cython-0.29.24.tar.gz

View File

@ -1,22 +0,0 @@
From 8d177f4aa51a663e8c51de3210ccb329d7629d36 Mon Sep 17 00:00:00 2001
From: Stefan Behnel <stefan_ml@behnel.de>
Date: Sat, 15 May 2021 22:38:57 +0200
Subject: [PATCH] Fix another direct usage of "tstate->use_tracing" in Py3.10.
---
Cython/Utility/Profile.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Cython/Utility/Profile.c b/Cython/Utility/Profile.c
index 3134aa0403..362cc93dda 100644
--- a/Cython/Utility/Profile.c
+++ b/Cython/Utility/Profile.c
@@ -298,7 +298,7 @@ static int __Pyx_TraceSetupAndCall(PyCodeObject** code,
tstate->tracing--;
if (retval) {
__Pyx_ErrRestoreInState(tstate, type, value, traceback);
- return tstate->use_tracing && retval;
+ return __Pyx_IsTracing(tstate, 0, 0) && retval;
} else {
Py_XDECREF(type);
Py_XDECREF(value);

View File

@ -5,17 +5,16 @@
%bcond_without cython_compile
Name: Cython
Version: 0.29.22
Release: 5%{?dist}
Version: 0.29.24
Release: 1%{?dist}
Summary: Language for writing Python extension modules
License: ASL 2.0
URL: http://www.cython.org
Source: https://github.com/cython/cython/archive/%{version}/Cython-%{version}.tar.gz
# Adapt tracing code to Python 3.10, 2 commits
Patch1: https://github.com/cython/cython/commit/fa5d2f5bc7.patch
Patch2: https://github.com/cython/cython/commit/8d177f4aa5.patch
# Fix test issue
Patch0: https://github.com/cython/cython/commit/bf4979e244.patch
BuildRequires: python3-devel
BuildRequires: python3-setuptools
@ -131,6 +130,9 @@ cp -p cython-mode-init.el cython-mode-init.elc %{buildroot}%{_emacs_sitestartdir
%changelog
* Wed Jul 21 2021 Scott Talbert <swt@techie.net> - 0.29.24-1
- Update to 0.29.24 to fix FTBFS with Python 3.10
* Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.29.22-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

23
bf4979e244.patch Normal file
View File

@ -0,0 +1,23 @@
From bf4979e2441ffbc9aaeb88f5c67608578040588f Mon Sep 17 00:00:00 2001
From: Stefan Behnel <stefan_ml@behnel.de>
Date: Sat, 3 Apr 2021 08:23:44 +0200
Subject: [PATCH] Make a helper function in a C++ test correctly propagate
exceptions so that it won't have to spit out compiler warnings.
---
tests/run/cpp_stl_conversion.pyx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/run/cpp_stl_conversion.pyx b/tests/run/cpp_stl_conversion.pyx
index 578915a0b7..3ea404d256 100644
--- a/tests/run/cpp_stl_conversion.pyx
+++ b/tests/run/cpp_stl_conversion.pyx
@@ -15,7 +15,7 @@ py_set = set
py_xrange = xrange
py_unicode = unicode
-cdef string add_strings(string a, string b):
+cdef string add_strings(string a, string b) except *:
return a + b
def normalize(bytes b):

View File

@ -1,213 +0,0 @@
From fa5d2f5bc7c8ffbc7f80971cd7e93085f77b61f2 Mon Sep 17 00:00:00 2001
From: Stefan Behnel <stefan_ml@behnel.de>
Date: Fri, 14 May 2021 19:39:58 +0200
Subject: [PATCH] Adapt tracing code to Py3.10 beta 1.
---
Cython/Utility/Profile.c | 79 +++++++++++++++++++++++++---------------
1 file changed, 49 insertions(+), 30 deletions(-)
diff --git a/Cython/Utility/Profile.c b/Cython/Utility/Profile.c
index 5f2de7e54b..3134aa0403 100644
--- a/Cython/Utility/Profile.c
+++ b/Cython/Utility/Profile.c
@@ -47,13 +47,32 @@
#define CYTHON_FRAME_DEL(frame) Py_CLEAR(frame)
#endif
- #define __Pyx_TraceDeclarations \
- static PyCodeObject *$frame_code_cname = NULL; \
- CYTHON_FRAME_MODIFIER PyFrameObject *$frame_cname = NULL; \
- int __Pyx_use_tracing = 0;
+ #define __Pyx_TraceDeclarations \
+ static PyCodeObject *$frame_code_cname = NULL; \
+ CYTHON_FRAME_MODIFIER PyFrameObject *$frame_cname = NULL; \
+ int __Pyx_use_tracing = 0;
- #define __Pyx_TraceFrameInit(codeobj) \
- if (codeobj) $frame_code_cname = (PyCodeObject*) codeobj;
+ #define __Pyx_TraceFrameInit(codeobj) \
+ if (codeobj) $frame_code_cname = (PyCodeObject*) codeobj;
+
+#if PY_VERSION_HEX >= 0x030a00b1
+ #define __Pyx_IsTracing(tstate, check_tracing, check_funcs) \
+ (unlikely(tstate->cframe->use_tracing) && \
+ (!(check_tracing) || !tstate->tracing) && \
+ (!(check_funcs) || tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc)))
+
+ #define __Pyx_SetTracing(tstate, enable) \
+ (tstate)->cframe->use_tracing = (enable)
+
+#else
+ #define __Pyx_IsTracing(tstate, check_tracing, check_funcs) \
+ (unlikely(tstate->use_tracing) && \
+ (!(check_tracing) || !tstate->tracing) && \
+ (!(check_funcs) || tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc)))
+
+ #define __Pyx_SetTracing(tstate, enable) \
+ (tstate)->use_tracing = (enable)
+#endif
#ifdef WITH_THREAD
#define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error) \
@@ -62,8 +81,7 @@
PyThreadState *tstate; \
PyGILState_STATE state = PyGILState_Ensure(); \
tstate = __Pyx_PyThreadState_Current; \
- if (unlikely(tstate->use_tracing) && !tstate->tracing && \
- (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc))) { \
+ if (__Pyx_IsTracing(tstate, 1, 1)) { \
__Pyx_use_tracing = __Pyx_TraceSetupAndCall(&$frame_code_cname, &$frame_cname, tstate, funcname, srcfile, firstlineno); \
} \
PyGILState_Release(state); \
@@ -71,8 +89,7 @@
} \
} else { \
PyThreadState* tstate = PyThreadState_GET(); \
- if (unlikely(tstate->use_tracing) && !tstate->tracing && \
- (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc))) { \
+ if (__Pyx_IsTracing(tstate, 1, 1)) { \
__Pyx_use_tracing = __Pyx_TraceSetupAndCall(&$frame_code_cname, &$frame_cname, tstate, funcname, srcfile, firstlineno); \
if (unlikely(__Pyx_use_tracing < 0)) goto_error; \
} \
@@ -80,8 +97,7 @@
#else
#define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error) \
{ PyThreadState* tstate = PyThreadState_GET(); \
- if (unlikely(tstate->use_tracing) && !tstate->tracing && \
- (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc))) { \
+ if (__Pyx_IsTracing(tstate, 1, 1)) { \
__Pyx_use_tracing = __Pyx_TraceSetupAndCall(&$frame_code_cname, &$frame_cname, tstate, funcname, srcfile, firstlineno); \
if (unlikely(__Pyx_use_tracing < 0)) goto_error; \
} \
@@ -91,10 +107,9 @@
#define __Pyx_TraceException() \
if (likely(!__Pyx_use_tracing)); else { \
PyThreadState* tstate = __Pyx_PyThreadState_Current; \
- if (tstate->use_tracing && \
- (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc))) { \
+ if (__Pyx_IsTracing(tstate, 0, 1)) { \
tstate->tracing++; \
- tstate->use_tracing = 0; \
+ __Pyx_SetTracing(tstate, 0); \
PyObject *exc_info = __Pyx_GetExceptionTuple(tstate); \
if (exc_info) { \
if (CYTHON_TRACE && tstate->c_tracefunc) \
@@ -104,7 +119,7 @@
tstate->c_profileobj, $frame_cname, PyTrace_EXCEPTION, exc_info); \
Py_DECREF(exc_info); \
} \
- tstate->use_tracing = 1; \
+ __Pyx_SetTracing(tstate, 1); \
tstate->tracing--; \
} \
}
@@ -113,13 +128,13 @@
PyObject *type, *value, *traceback;
__Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
tstate->tracing++;
- tstate->use_tracing = 0;
+ __Pyx_SetTracing(tstate, 0);
if (CYTHON_TRACE && tstate->c_tracefunc)
tstate->c_tracefunc(tstate->c_traceobj, frame, PyTrace_RETURN, result);
if (tstate->c_profilefunc)
tstate->c_profilefunc(tstate->c_profileobj, frame, PyTrace_RETURN, result);
CYTHON_FRAME_DEL(frame);
- tstate->use_tracing = 1;
+ __Pyx_SetTracing(tstate, 1);
tstate->tracing--;
__Pyx_ErrRestoreInState(tstate, type, value, traceback);
}
@@ -132,14 +147,14 @@
PyThreadState *tstate; \
PyGILState_STATE state = PyGILState_Ensure(); \
tstate = __Pyx_PyThreadState_Current; \
- if (tstate->use_tracing) { \
+ if (__Pyx_IsTracing(tstate, 0, 0)) { \
__Pyx_call_return_trace_func(tstate, $frame_cname, (PyObject*)result); \
} \
PyGILState_Release(state); \
} \
} else { \
PyThreadState* tstate = __Pyx_PyThreadState_Current; \
- if (tstate->use_tracing) { \
+ if (__Pyx_IsTracing(tstate, 0, 0)) { \
__Pyx_call_return_trace_func(tstate, $frame_cname, (PyObject*)result); \
} \
} \
@@ -148,7 +163,7 @@
#define __Pyx_TraceReturn(result, nogil) \
if (likely(!__Pyx_use_tracing)); else { \
PyThreadState* tstate = __Pyx_PyThreadState_Current; \
- if (tstate->use_tracing) { \
+ if (__Pyx_IsTracing(tstate, 0, 0)) { \
__Pyx_call_return_trace_func(tstate, $frame_cname, (PyObject*)result); \
} \
}
@@ -176,9 +191,11 @@
__Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
__Pyx_PyFrame_SetLineNumber(frame, lineno);
tstate->tracing++;
- tstate->use_tracing = 0;
+ __Pyx_SetTracing(tstate, 0);
+
ret = tstate->c_tracefunc(tstate->c_traceobj, frame, PyTrace_LINE, NULL);
- tstate->use_tracing = 1;
+
+ __Pyx_SetTracing(tstate, 1);
tstate->tracing--;
if (likely(!ret)) {
__Pyx_ErrRestoreInState(tstate, type, value, traceback);
@@ -199,7 +216,7 @@
PyThreadState *tstate; \
PyGILState_STATE state = PyGILState_Ensure(); \
tstate = __Pyx_PyThreadState_Current; \
- if (unlikely(tstate->use_tracing && tstate->c_tracefunc && $frame_cname->f_trace)) { \
+ if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && $frame_cname->f_trace) { \
ret = __Pyx_call_line_trace_func(tstate, $frame_cname, lineno); \
} \
PyGILState_Release(state); \
@@ -207,7 +224,7 @@
} \
} else { \
PyThreadState* tstate = __Pyx_PyThreadState_Current; \
- if (unlikely(tstate->use_tracing && tstate->c_tracefunc && $frame_cname->f_trace)) { \
+ if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && $frame_cname->f_trace) { \
int ret = __Pyx_call_line_trace_func(tstate, $frame_cname, lineno); \
if (unlikely(ret)) goto_error; \
} \
@@ -217,7 +234,7 @@
#define __Pyx_TraceLine(lineno, nogil, goto_error) \
if (likely(!__Pyx_use_tracing)); else { \
PyThreadState* tstate = __Pyx_PyThreadState_Current; \
- if (unlikely(tstate->use_tracing && tstate->c_tracefunc && $frame_cname->f_trace)) { \
+ if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && $frame_cname->f_trace) { \
int ret = __Pyx_call_line_trace_func(tstate, $frame_cname, lineno); \
if (unlikely(ret)) goto_error; \
} \
@@ -263,19 +280,21 @@ static int __Pyx_TraceSetupAndCall(PyCodeObject** code,
(*frame)->f_tstate = tstate;
#endif
}
- __Pyx_PyFrame_SetLineNumber(*frame, firstlineno);
+ __Pyx_PyFrame_SetLineNumber(*frame, firstlineno);
+
retval = 1;
tstate->tracing++;
- tstate->use_tracing = 0;
+ __Pyx_SetTracing(tstate, 0);
__Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
+
#if CYTHON_TRACE
if (tstate->c_tracefunc)
retval = tstate->c_tracefunc(tstate->c_traceobj, *frame, PyTrace_CALL, NULL) == 0;
if (retval && tstate->c_profilefunc)
#endif
retval = tstate->c_profilefunc(tstate->c_profileobj, *frame, PyTrace_CALL, NULL) == 0;
- tstate->use_tracing = (tstate->c_profilefunc ||
- (CYTHON_TRACE && tstate->c_tracefunc));
+
+ __Pyx_SetTracing(tstate, (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc)));
tstate->tracing--;
if (retval) {
__Pyx_ErrRestoreInState(tstate, type, value, traceback);

View File

@ -1 +1 @@
SHA512 (Cython-0.29.22.tar.gz) = b7f22112678f159bf1d0ad5fe4f7c103e96f240bab4d9dc07edd7c2f66a9887b9af72b32f1d5886361b48d428bc2b9499d3c5b59ce5af1068f20a26549783dd6
SHA512 (Cython-0.29.24.tar.gz) = 387a827f3cb7428248019744e3ed606a133d98ac882b83624d24ae0fdf8a8f2334978555d7d84e5cc4adaf715c541fef64e45bcbdda85ca33473c21f99360be8