Skip to content

Commit 03c498d

Browse files
committed
Avoid using the thread state attribute "use_tracing" in Python 3.12 where it was removed from the struct.
See PEP-669 (https://peps.python.org/pep-0669/) and the implementation in python/cpython#103083. There is more to be done to properly support PEP-669, but this makes it compile. See #5450
1 parent d82e4e3 commit 03c498d

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Cython/Utility/Profile.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,21 @@
6161
#define __Pyx_TraceFrameInit(codeobj) \
6262
if (codeobj) $frame_code_cname = (PyCodeObject*) codeobj;
6363

64+
6465
#if PY_VERSION_HEX >= 0x030b00a2
66+
#if PY_VERSION_HEX >= 0x030C00b1
67+
#define __Pyx_IsTracing(tstate, check_tracing, check_funcs) \
68+
((!(check_tracing) || !(tstate)->tracing) && \
69+
(!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc)))
70+
#else
6571
#define __Pyx_IsTracing(tstate, check_tracing, check_funcs) \
6672
(unlikely((tstate)->cframe->use_tracing) && \
6773
(!(check_tracing) || !(tstate)->tracing) && \
6874
(!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc)))
75+
#endif
6976

70-
#define __Pyx_EnterTracing(tstate) PyThreadState_EnterTracing(tstate)
71-
72-
#define __Pyx_LeaveTracing(tstate) PyThreadState_LeaveTracing(tstate)
77+
#define __Pyx_EnterTracing(tstate) PyThreadState_EnterTracing(tstate)
78+
#define __Pyx_LeaveTracing(tstate) PyThreadState_LeaveTracing(tstate)
7379

7480
#elif PY_VERSION_HEX >= 0x030a00b1
7581
#define __Pyx_IsTracing(tstate, check_tracing, check_funcs) \

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy