New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tracing report events leak on trace function failures for doctest-implemented functions in 3.11 #94381
Comments
I don't fully know understand the details but it seems like |
Here is a much reduced version that demonstrates the issue:
It does need to be compiled in Cython which leads me to think it might not actually be a Python bug. The tracing functions are all in Can be run with
|
…Py3.11 (GH-4851) Thus fixing linetracing tests in Python 3.11 when the trace function raises an exception. The issue we were seeing looked to be something to do with functions defined within doctest docstrings. It was fixed by moving the "defined-in-Python" functions into an exec call instead. See python/cpython#94381
I've updated title and description to make it clear that this is related to failing trace functions. |
A further simplified version that eliminates a little more Cython from it
This no longer uses Cython's line tracing code - the error is now triggered by a Note that Cython automatically populates a |
This looks to be fixed on Python 3.11b4 |
scoder commentedJun 28, 2022
•
edited
Bug report
In Py3.11, one of our tracing tests in Cython is reporting trace events at different times than before. The difference is for Python functions that we implement inside of doctests (so that they remain uncompiled). We use a C trace function to collect the events.
https://github.com/cython/cython/blob/7ab11ec473a604792bae454305adece55cd8ab37/tests/run/line_trace.pyx
The failing test is
fail_on_call_trace
, where an exception is raised from the trace function. This seems to leak the last trace event into the next trace execution.We can apparently resolve the issue by moving the functions into Python sections using
exec()
https://github.com/cython/cython/pull/4851/files
so this looks like a strictly doctest related issue.
Here is the difference from our test output. Note how some trace events arbitrarily leak into later test runs.
Only the plain Python comparison tests are failing, while the tests for the C compiled functions continue to work as expected, as do the Python functions when not implemented in doctests.
Your environment
The text was updated successfully, but these errors were encountered: