Repository navigation
Fix loop completion arcs on Python 3.14 - #2281
Merged
Merged
Conversation
Contributor
Author
Member
|
Thanks for the work, and for seeing the duplication, but I prefer this change. Re-opening, and making a few tweaks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2168.
On Python 3.14, both settrace-based cores can receive a
returnevent after the frame's current line has advanced without a preceding line event for that final source line. They were therefore recording the function-exit arc from the previous line, which can make normal loop exhaustion immediately before return appear as a missing branch.For real returns on Python 3.14+, ctrace and pytrace now record that final line transition first when needed, then record the function-exit arc. Sysmon already reports the expected loop-completion arc.
The regression covers empty, exhausted, and broken-loop paths. On Python 3.14.7 the exact reproducer reports 100% branch coverage with both ctrace and pytrace after the fix; the complete
tests/test_arcs.pysuite also passes under both cores. A broader return/loop/try-finally probe produced identical raw arc sets for ctrace and pytrace.PyTracer's trace callback cannot itself be measured by meta-coverage, so the new callback branch uses the repository's
pragma: not coveredmarker. A direct PyTracer return-frame test exercises the same transition outside the trace callback, while the end-to-end arc regression verifies the real tracing behavior.