-
-
Notifications
You must be signed in to change notification settings - Fork 447
Support coverage plugins with sys.monitoring #1790
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
Comments
…upport for these tests. coverage.py does not (yet?) support sys.monitoring with the Cython plugin yet. See nedbat/coveragepy#1790
* Change profiling/tracing to line up more with CPython's trace events, including function/generator return value reporting. * Clean up the ownership of code objects between functions and their def/cpdef wrappers. The code object is now owned by the innermost tree node (wrapper) and used by the outer syntax node (lambda, function). All CFuncDefNodes now have a code object (not just those with Python wrappers) and fused functions use a separate code object for each specialisation. * Use the code object of the (user facing) generator function also for the generator body (instead of the other way round) since the body has a different signature. * Fix code object creation for Lambda nodes by moving it after initialising the scope since we need to know the local scope to correctly include args and kwargs. * Implement exception monitoring and remove the code in pre-monitoring Python versions since it was never actually used. * Fix 'skip_dispatch' condition for module level cpdef functions. This was previously always off because it incorrectly reversed the "lookup_module_cpdef" option. * Enable line tracing for 'pass' statements to avoid coverage lacks. * Implement support for STOP_ITERATION events, but do not use it for now since it's difficult to find the few cases where CPython triggers it. * Add trace logger in pstats/monitoring test as debug helper for comparing Python with Cython. * Trace yields as generator returns in non-monitoring Python versions (<3.13). * Trace exception returns as regular returns in non-monitoring Python versions (<3.13). * Use pre sys.monitoring line tracing in Py3.12 and enable coverage testing in Py3.12 with the old tracing infrastructure. * Enable coverage.py on Py3.13 by disabling the sys.monitoring support for these tests. coverage.py does not (yet?) support sys.monitoring with the Cython plugin yet. See nedbat/coveragepy#1790 * Disable tracing tests in PyPy which lacks the entire tracing infrastructure (both old and new). * Fix a Unicode encoding issue when using the module init function name for tracing and the refnanny. * Document the user facing C trace macros. * Implement a "linetable" for CodeObjects as described in PEP-626. This allows the CodeObjects to calculate correct line/column positions when tracing. * Always report function returns, not just when we have a reportable return value. * Prevent re-entry into tracing code while running a trace function. * Test runner: Set PYTHONFAULTHANDLER=1 to enable it also in end-to-end tests.
Ping @nedbat. Any hint on what's missing to make this work? |
Hi, sorry to let this sit. What plugin behavior in particular are you looking for? The key idea of sys.monitoring that makes it fast is to disable an event once it's fired, but some plugin methods would need the events to be re-enabled. This is extra choreography that I haven't really thought through yet, and I hope it doesn't completely nullify the speed benefits. |
Is your feature request related to a problem? Please describe.
Running coverage.py on Cython code with
sys.monitoring
in Py3.13 disables the Cython coverage plugin:coveragepy/coverage/control.py
Lines 565 to 568 in 7f33622
Describe the solution you'd like
Plugins should work the same with the old tracing and new monitoring infrastructure.
Additional context
I'm currently working on getting Cython to use the monitoring C-API, but found that coverage.py doesn't support both together as it stands.
The text was updated successfully, but these errors were encountered: