From: "Marek Szuba" <marecki@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/cython/files/, dev-python/cython/
Date: Sat, 15 May 2021 00:36:45 +0000 (UTC) [thread overview]
Message-ID: <1621038991.56e03cffa7bcb4b7b3043360e28e89cf308714e5.marecki@gentoo> (raw)
commit: 56e03cffa7bcb4b7b3043360e28e89cf308714e5
Author: Marek Szuba <marecki <AT> gentoo <DOT> org>
AuthorDate: Fri May 14 23:11:37 2021 +0000
Commit: Marek Szuba <marecki <AT> gentoo <DOT> org>
CommitDate: Sat May 15 00:36:31 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=56e03cff
dev-python/cython: backport tracing fix for python3_10 compatibility
Spotted it now that I am able to run the cython test suite.
There is another error, in test_exceptions.pyx, stemming from the fact
IndentationError messages in 3.10 are more verbose (e.g.
expected an indented block after 'if' statement on line 1
instead of simply
expected an indented block) - that one however seems to be a test-only
issue.
Signed-off-by: Marek Szuba <marecki <AT> gentoo.org>
dev-python/cython/cython-0.29.23.ebuild | 1 +
.../files/cython-0.29.23-tracing-py310.patch | 213 +++++++++++++++++++++
2 files changed, 214 insertions(+)
diff --git a/dev-python/cython/cython-0.29.23.ebuild b/dev-python/cython/cython-0.29.23.ebuild
index eb35100a371..d091b7190eb 100644
--- a/dev-python/cython/cython-0.29.23.ebuild
+++ b/dev-python/cython/cython-0.29.23.ebuild
@@ -32,6 +32,7 @@ BDEPEND="${RDEPEND}
PATCHES=(
"${FILESDIR}/${PN}-0.29.14-sphinx-update.patch"
"${FILESDIR}/${PN}-0.29.22-spawn-multiprocessing.patch"
+ "${FILESDIR}/${PN}-0.29.23-tracing-py310.patch"
)
SITEFILE=50cython-gentoo.el
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
new file mode 100644
index 00000000000..ff0e45a646d
--- /dev/null
+++ b/dev-python/cython/files/cython-0.29.23-tracing-py310.patch
@@ -0,0 +1,213 @@
+From c9cccfeaf3f0e20c2bb14fc234e86f4fc8e4fe81 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 15ceb41cc2..2cd9af9da7 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 = __Pyx_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); \
+ } \
+ __Pyx_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);
next reply other threads:[~2021-05-15 0:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-15 0:36 Marek Szuba [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-04-18 12:38 [gentoo-commits] repo/gentoo:master commit in: dev-python/cython/files/, dev-python/cython/ Michał Górny
2023-10-02 4:22 Michał Górny
2023-09-12 7:05 Michał Górny
2023-07-28 11:07 Sam James
2023-07-17 17:53 Sam James
2023-06-15 18:26 Michał Górny
2023-03-24 5:12 Sam James
2021-09-03 18:18 Michał Górny
2021-03-06 3:24 Sam James
2020-12-10 19:41 Sam James
2020-06-15 13:20 Michał Górny
2019-11-20 4:56 Patrick McLean
2019-07-04 3:27 Tim Harder
2016-03-24 11:16 Ian Delaney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1621038991.56e03cffa7bcb4b7b3043360e28e89cf308714e5.marecki@gentoo \
--to=marecki@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox