1 |
commit: 56e03cffa7bcb4b7b3043360e28e89cf308714e5 |
2 |
Author: Marek Szuba <marecki <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri May 14 23:11:37 2021 +0000 |
4 |
Commit: Marek Szuba <marecki <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat May 15 00:36:31 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=56e03cff |
7 |
|
8 |
dev-python/cython: backport tracing fix for python3_10 compatibility |
9 |
|
10 |
Spotted it now that I am able to run the cython test suite. |
11 |
There is another error, in test_exceptions.pyx, stemming from the fact |
12 |
IndentationError messages in 3.10 are more verbose (e.g. |
13 |
|
14 |
expected an indented block after 'if' statement on line 1 |
15 |
|
16 |
instead of simply |
17 |
|
18 |
expected an indented block) - that one however seems to be a test-only |
19 |
issue. |
20 |
|
21 |
Signed-off-by: Marek Szuba <marecki <AT> gentoo.org> |
22 |
|
23 |
dev-python/cython/cython-0.29.23.ebuild | 1 + |
24 |
.../files/cython-0.29.23-tracing-py310.patch | 213 +++++++++++++++++++++ |
25 |
2 files changed, 214 insertions(+) |
26 |
|
27 |
diff --git a/dev-python/cython/cython-0.29.23.ebuild b/dev-python/cython/cython-0.29.23.ebuild |
28 |
index eb35100a371..d091b7190eb 100644 |
29 |
--- a/dev-python/cython/cython-0.29.23.ebuild |
30 |
+++ b/dev-python/cython/cython-0.29.23.ebuild |
31 |
@@ -32,6 +32,7 @@ BDEPEND="${RDEPEND} |
32 |
PATCHES=( |
33 |
"${FILESDIR}/${PN}-0.29.14-sphinx-update.patch" |
34 |
"${FILESDIR}/${PN}-0.29.22-spawn-multiprocessing.patch" |
35 |
+ "${FILESDIR}/${PN}-0.29.23-tracing-py310.patch" |
36 |
) |
37 |
|
38 |
SITEFILE=50cython-gentoo.el |
39 |
|
40 |
diff --git a/dev-python/cython/files/cython-0.29.23-tracing-py310.patch b/dev-python/cython/files/cython-0.29.23-tracing-py310.patch |
41 |
new file mode 100644 |
42 |
index 00000000000..ff0e45a646d |
43 |
--- /dev/null |
44 |
+++ b/dev-python/cython/files/cython-0.29.23-tracing-py310.patch |
45 |
@@ -0,0 +1,213 @@ |
46 |
+From c9cccfeaf3f0e20c2bb14fc234e86f4fc8e4fe81 Mon Sep 17 00:00:00 2001 |
47 |
+From: Stefan Behnel <stefan_ml@××××××.de> |
48 |
+Date: Fri, 14 May 2021 19:39:58 +0200 |
49 |
+Subject: [PATCH] Adapt tracing code to Py3.10 beta 1. |
50 |
+ |
51 |
+--- |
52 |
+ Cython/Utility/Profile.c | 79 +++++++++++++++++++++++++--------------- |
53 |
+ 1 file changed, 49 insertions(+), 30 deletions(-) |
54 |
+ |
55 |
+diff --git a/Cython/Utility/Profile.c b/Cython/Utility/Profile.c |
56 |
+index 15ceb41cc2..2cd9af9da7 100644 |
57 |
+--- a/Cython/Utility/Profile.c |
58 |
++++ b/Cython/Utility/Profile.c |
59 |
+@@ -47,13 +47,32 @@ |
60 |
+ #define CYTHON_FRAME_DEL(frame) Py_CLEAR(frame) |
61 |
+ #endif |
62 |
+ |
63 |
+- #define __Pyx_TraceDeclarations \ |
64 |
+- static PyCodeObject *$frame_code_cname = NULL; \ |
65 |
+- CYTHON_FRAME_MODIFIER PyFrameObject *$frame_cname = NULL; \ |
66 |
+- int __Pyx_use_tracing = 0; |
67 |
++ #define __Pyx_TraceDeclarations \ |
68 |
++ static PyCodeObject *$frame_code_cname = NULL; \ |
69 |
++ CYTHON_FRAME_MODIFIER PyFrameObject *$frame_cname = NULL; \ |
70 |
++ int __Pyx_use_tracing = 0; |
71 |
+ |
72 |
+- #define __Pyx_TraceFrameInit(codeobj) \ |
73 |
+- if (codeobj) $frame_code_cname = (PyCodeObject*) codeobj; |
74 |
++ #define __Pyx_TraceFrameInit(codeobj) \ |
75 |
++ if (codeobj) $frame_code_cname = (PyCodeObject*) codeobj; |
76 |
++ |
77 |
++#if PY_VERSION_HEX >= 0x030a00b1 |
78 |
++ #define __Pyx_IsTracing(tstate, check_tracing, check_funcs) \ |
79 |
++ (unlikely(tstate->cframe->use_tracing) && \ |
80 |
++ (!(check_tracing) || !tstate->tracing) && \ |
81 |
++ (!(check_funcs) || tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc))) |
82 |
++ |
83 |
++ #define __Pyx_SetTracing(tstate, enable) \ |
84 |
++ (tstate)->cframe->use_tracing = (enable) |
85 |
++ |
86 |
++#else |
87 |
++ #define __Pyx_IsTracing(tstate, check_tracing, check_funcs) \ |
88 |
++ (unlikely(tstate->use_tracing) && \ |
89 |
++ (!(check_tracing) || !tstate->tracing) && \ |
90 |
++ (!(check_funcs) || tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc))) |
91 |
++ |
92 |
++ #define __Pyx_SetTracing(tstate, enable) \ |
93 |
++ (tstate)->use_tracing = (enable) |
94 |
++#endif |
95 |
+ |
96 |
+ #ifdef WITH_THREAD |
97 |
+ #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error) \ |
98 |
+@@ -62,8 +81,7 @@ |
99 |
+ PyThreadState *tstate; \ |
100 |
+ PyGILState_STATE state = PyGILState_Ensure(); \ |
101 |
+ tstate = __Pyx_PyThreadState_Current; \ |
102 |
+- if (unlikely(tstate->use_tracing) && !tstate->tracing && \ |
103 |
+- (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc))) { \ |
104 |
++ if (__Pyx_IsTracing(tstate, 1, 1)) { \ |
105 |
+ __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&$frame_code_cname, &$frame_cname, tstate, funcname, srcfile, firstlineno); \ |
106 |
+ } \ |
107 |
+ PyGILState_Release(state); \ |
108 |
+@@ -71,8 +89,7 @@ |
109 |
+ } \ |
110 |
+ } else { \ |
111 |
+ PyThreadState* tstate = PyThreadState_GET(); \ |
112 |
+- if (unlikely(tstate->use_tracing) && !tstate->tracing && \ |
113 |
+- (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc))) { \ |
114 |
++ if (__Pyx_IsTracing(tstate, 1, 1)) { \ |
115 |
+ __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&$frame_code_cname, &$frame_cname, tstate, funcname, srcfile, firstlineno); \ |
116 |
+ if (unlikely(__Pyx_use_tracing < 0)) goto_error; \ |
117 |
+ } \ |
118 |
+@@ -80,8 +97,7 @@ |
119 |
+ #else |
120 |
+ #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error) \ |
121 |
+ { PyThreadState* tstate = PyThreadState_GET(); \ |
122 |
+- if (unlikely(tstate->use_tracing) && !tstate->tracing && \ |
123 |
+- (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc))) { \ |
124 |
++ if (__Pyx_IsTracing(tstate, 1, 1)) { \ |
125 |
+ __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&$frame_code_cname, &$frame_cname, tstate, funcname, srcfile, firstlineno); \ |
126 |
+ if (unlikely(__Pyx_use_tracing < 0)) goto_error; \ |
127 |
+ } \ |
128 |
+@@ -91,10 +107,9 @@ |
129 |
+ #define __Pyx_TraceException() \ |
130 |
+ if (likely(!__Pyx_use_tracing)); else { \ |
131 |
+ PyThreadState* tstate = __Pyx_PyThreadState_Current; \ |
132 |
+- if (tstate->use_tracing && \ |
133 |
+- (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc))) { \ |
134 |
++ if (__Pyx_IsTracing(tstate, 0, 1)) { \ |
135 |
+ tstate->tracing++; \ |
136 |
+- tstate->use_tracing = 0; \ |
137 |
++ __Pyx_SetTracing(tstate, 0); \ |
138 |
+ PyObject *exc_info = __Pyx_GetExceptionTuple(tstate); \ |
139 |
+ if (exc_info) { \ |
140 |
+ if (CYTHON_TRACE && tstate->c_tracefunc) \ |
141 |
+@@ -104,7 +119,7 @@ |
142 |
+ tstate->c_profileobj, $frame_cname, PyTrace_EXCEPTION, exc_info); \ |
143 |
+ Py_DECREF(exc_info); \ |
144 |
+ } \ |
145 |
+- tstate->use_tracing = 1; \ |
146 |
++ __Pyx_SetTracing(tstate, 1); \ |
147 |
+ tstate->tracing--; \ |
148 |
+ } \ |
149 |
+ } |
150 |
+@@ -113,13 +128,13 @@ |
151 |
+ PyObject *type, *value, *traceback; |
152 |
+ __Pyx_ErrFetchInState(tstate, &type, &value, &traceback); |
153 |
+ tstate->tracing++; |
154 |
+- tstate->use_tracing = 0; |
155 |
++ __Pyx_SetTracing(tstate, 0); |
156 |
+ if (CYTHON_TRACE && tstate->c_tracefunc) |
157 |
+ tstate->c_tracefunc(tstate->c_traceobj, frame, PyTrace_RETURN, result); |
158 |
+ if (tstate->c_profilefunc) |
159 |
+ tstate->c_profilefunc(tstate->c_profileobj, frame, PyTrace_RETURN, result); |
160 |
+ CYTHON_FRAME_DEL(frame); |
161 |
+- tstate->use_tracing = 1; |
162 |
++ __Pyx_SetTracing(tstate, 1); |
163 |
+ tstate->tracing--; |
164 |
+ __Pyx_ErrRestoreInState(tstate, type, value, traceback); |
165 |
+ } |
166 |
+@@ -132,14 +147,14 @@ |
167 |
+ PyThreadState *tstate; \ |
168 |
+ PyGILState_STATE state = PyGILState_Ensure(); \ |
169 |
+ tstate = __Pyx_PyThreadState_Current; \ |
170 |
+- if (tstate->use_tracing) { \ |
171 |
++ if (__Pyx_IsTracing(tstate, 0, 0)) { \ |
172 |
+ __Pyx_call_return_trace_func(tstate, $frame_cname, (PyObject*)result); \ |
173 |
+ } \ |
174 |
+ PyGILState_Release(state); \ |
175 |
+ } \ |
176 |
+ } else { \ |
177 |
+ PyThreadState* tstate = __Pyx_PyThreadState_Current; \ |
178 |
+- if (tstate->use_tracing) { \ |
179 |
++ if (__Pyx_IsTracing(tstate, 0, 0)) { \ |
180 |
+ __Pyx_call_return_trace_func(tstate, $frame_cname, (PyObject*)result); \ |
181 |
+ } \ |
182 |
+ } \ |
183 |
+@@ -148,7 +163,7 @@ |
184 |
+ #define __Pyx_TraceReturn(result, nogil) \ |
185 |
+ if (likely(!__Pyx_use_tracing)); else { \ |
186 |
+ PyThreadState* tstate = __Pyx_PyThreadState_Current; \ |
187 |
+- if (tstate->use_tracing) { \ |
188 |
++ if (__Pyx_IsTracing(tstate, 0, 0)) { \ |
189 |
+ __Pyx_call_return_trace_func(tstate, $frame_cname, (PyObject*)result); \ |
190 |
+ } \ |
191 |
+ } |
192 |
+@@ -176,9 +191,11 @@ |
193 |
+ __Pyx_ErrFetchInState(tstate, &type, &value, &traceback); |
194 |
+ __Pyx_PyFrame_SetLineNumber(frame, lineno); |
195 |
+ tstate->tracing++; |
196 |
+- tstate->use_tracing = 0; |
197 |
++ __Pyx_SetTracing(tstate, 0); |
198 |
++ |
199 |
+ ret = tstate->c_tracefunc(tstate->c_traceobj, frame, PyTrace_LINE, NULL); |
200 |
+- tstate->use_tracing = 1; |
201 |
++ |
202 |
++ __Pyx_SetTracing(tstate, 1); |
203 |
+ tstate->tracing--; |
204 |
+ if (likely(!ret)) { |
205 |
+ __Pyx_ErrRestoreInState(tstate, type, value, traceback); |
206 |
+@@ -199,7 +216,7 @@ |
207 |
+ PyThreadState *tstate; \ |
208 |
+ PyGILState_STATE state = __Pyx_PyGILState_Ensure(); \ |
209 |
+ tstate = __Pyx_PyThreadState_Current; \ |
210 |
+- if (unlikely(tstate->use_tracing && tstate->c_tracefunc && $frame_cname->f_trace)) { \ |
211 |
++ if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && $frame_cname->f_trace) { \ |
212 |
+ ret = __Pyx_call_line_trace_func(tstate, $frame_cname, lineno); \ |
213 |
+ } \ |
214 |
+ __Pyx_PyGILState_Release(state); \ |
215 |
+@@ -207,7 +224,7 @@ |
216 |
+ } \ |
217 |
+ } else { \ |
218 |
+ PyThreadState* tstate = __Pyx_PyThreadState_Current; \ |
219 |
+- if (unlikely(tstate->use_tracing && tstate->c_tracefunc && $frame_cname->f_trace)) { \ |
220 |
++ if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && $frame_cname->f_trace) { \ |
221 |
+ int ret = __Pyx_call_line_trace_func(tstate, $frame_cname, lineno); \ |
222 |
+ if (unlikely(ret)) goto_error; \ |
223 |
+ } \ |
224 |
+@@ -217,7 +234,7 @@ |
225 |
+ #define __Pyx_TraceLine(lineno, nogil, goto_error) \ |
226 |
+ if (likely(!__Pyx_use_tracing)); else { \ |
227 |
+ PyThreadState* tstate = __Pyx_PyThreadState_Current; \ |
228 |
+- if (unlikely(tstate->use_tracing && tstate->c_tracefunc && $frame_cname->f_trace)) { \ |
229 |
++ if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && $frame_cname->f_trace) { \ |
230 |
+ int ret = __Pyx_call_line_trace_func(tstate, $frame_cname, lineno); \ |
231 |
+ if (unlikely(ret)) goto_error; \ |
232 |
+ } \ |
233 |
+@@ -263,19 +280,21 @@ static int __Pyx_TraceSetupAndCall(PyCodeObject** code, |
234 |
+ (*frame)->f_tstate = tstate; |
235 |
+ #endif |
236 |
+ } |
237 |
+- __Pyx_PyFrame_SetLineNumber(*frame, firstlineno); |
238 |
++ __Pyx_PyFrame_SetLineNumber(*frame, firstlineno); |
239 |
++ |
240 |
+ retval = 1; |
241 |
+ tstate->tracing++; |
242 |
+- tstate->use_tracing = 0; |
243 |
++ __Pyx_SetTracing(tstate, 0); |
244 |
+ __Pyx_ErrFetchInState(tstate, &type, &value, &traceback); |
245 |
++ |
246 |
+ #if CYTHON_TRACE |
247 |
+ if (tstate->c_tracefunc) |
248 |
+ retval = tstate->c_tracefunc(tstate->c_traceobj, *frame, PyTrace_CALL, NULL) == 0; |
249 |
+ if (retval && tstate->c_profilefunc) |
250 |
+ #endif |
251 |
+ retval = tstate->c_profilefunc(tstate->c_profileobj, *frame, PyTrace_CALL, NULL) == 0; |
252 |
+- tstate->use_tracing = (tstate->c_profilefunc || |
253 |
+- (CYTHON_TRACE && tstate->c_tracefunc)); |
254 |
++ |
255 |
++ __Pyx_SetTracing(tstate, (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc))); |
256 |
+ tstate->tracing--; |
257 |
+ if (retval) { |
258 |
+ __Pyx_ErrRestoreInState(tstate, type, value, traceback); |