You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] compilation with linetrace fails with 3.12 + 3.0.0b3 #5450
When compiling with linetrace=True, compilation fails with:
error: ‘_PyCFrame’ has no member named ‘use_tracing’
full output
/root/.pyxbld/temp.linux-aarch64-cpython-312/io/ctest.c: In function ‘__pyx_f_5ctest_twice’:
/root/.pyxbld/temp.linux-aarch64-cpython-312/io/ctest.c:1537:32: error: ‘_PyCFrame’ has no member named ‘use_tracing’
1537 | (unlikely((tstate)->cframe->use_tracing) &&\
| ^~
/root/.pyxbld/temp.linux-aarch64-cpython-312/io/ctest.c:1330:43: note: in definition of macro ‘unlikely’
1330 | #define unlikely(x) __builtin_expect(!!(x), 0)
| ^
/root/.pyxbld/temp.linux-aarch64-cpython-312/io/ctest.c:1576:15: note: in expansion of macro ‘__Pyx_IsTracing’
1576 | if (__Pyx_IsTracing(tstate, 1, 1)) {\
| ^~~~~~~~~~~~~~~
/root/.pyxbld/temp.linux-aarch64-cpython-312/io/ctest.c:2250:3: note: in expansion of macro ‘__Pyx_TraceCall’
2250 | __Pyx_TraceCall("twice", __pyx_f[0], 3, 0, __PYX_ERR(0, 3, __pyx_L1_error));
| ^~~~~~~~~~~~~~~
Code to reproduce the behaviour:
#cython: linetrace=True
cpdef int twice(int x):
return2* x
Expected behaviour
No error
OS
Linux (arm64, docker image python:3.12.0b1)
Python version
3.12.0b1
Cython version
3.0.0b3
Additional context
Minimal test case tested via pyximport in arm64 python:3.12.0b1 docker image (sha256:64a039039087f8a7fde61b973dc3137ab9494979948b98435421a125f386a967), originally found on pyzmq
The compilation problem is resolved in 03c498d – however, that doesn't mean that profiling/tracing now works in Py3.12. I'll create a new issue for that.
Even if we backported that change, profiling and tracing still wouldn't work in Python 3.12. It only avoids the compile failure. It seems better to make it fail loudly in 0.29.x than to let users run into a silently dysfunctional feature.
Note that no larger changes are allowed into 0.29.x any more, so the feature is unlikely to get re-enabled there for Python 3.12+. You can still use Python 3.11 if you want to profile your code with 0.29.x.
Activity
[-][BUG] linetrace fails with 3.12 + 3.0.0b3[/-][+][BUG] compilation with linetrace fails with 3.12 + 3.0.0b3[/+]Avoid using the thread state attribute "use_tracing" in Python 3.12 w…
scoder commentedon Jun 6, 2023
The compilation problem is resolved in 03c498d – however, that doesn't mean that profiling/tracing now works in Py3.12. I'll create a new issue for that.
shadchin commentedon Aug 16, 2023
Maybe it's possible to backport 03c498d to 0.29.x branch?
zoj613 commentedon Aug 28, 2023
I'm getting the same failure using
0.29.36with the message:error: no member named 'use_tracing' in 'struct _PyCFrame'scoder commentedon Aug 29, 2023
Even if we backported that change, profiling and tracing still wouldn't work in Python 3.12. It only avoids the compile failure. It seems better to make it fail loudly in 0.29.x than to let users run into a silently dysfunctional feature.
Note that no larger changes are allowed into 0.29.x any more, so the feature is unlikely to get re-enabled there for Python 3.12+. You can still use Python 3.11 if you want to profile your code with 0.29.x.
py312: disable cython profile=true in one file
py312: disable cython profile=true in one file
py312: disable cython profile=true in one file