Skip to content

[BUG] compilation with linetrace fails with 3.12 + 3.0.0b3 #5450

Closed

Description

@minrk

Describe the bug

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):
    return 2 * 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

Activity

  1. changed the title [-][BUG] linetrace fails with 3.12 + 3.0.0b3[/-] [+][BUG] compilation with linetrace fails with 3.12 + 3.0.0b3[/+] on May 26, 2023
  2. added this to the 3.0 milestone on Jun 6, 2023
  3. scoder commented on Jun 6, 2023

    @scoder
    Contributor

    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.

  4. shadchin commented on Aug 16, 2023

    @shadchin
    Contributor

    Maybe it's possible to backport 03c498d to 0.29.x branch?

  5. zoj613 commented on Aug 28, 2023

    @zoj613
    Contributor

    I'm getting the same failure using 0.29.36 with the message: error: no member named 'use_tracing' in 'struct _PyCFrame'

  6. scoder commented on Aug 29, 2023

    @scoder
    Contributor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions