Handle loop-completion arc before function exit by itscloud0 · Pull Request #2204 · coveragepy/coveragepy · GitHub
Skip to content

Handle loop-completion arc before function exit#2204

Open
itscloud0 wants to merge 2 commits into
coveragepy:mainfrom
itscloud0:fix-2168-ctrace-loop-branch
Open

Handle loop-completion arc before function exit#2204
itscloud0 wants to merge 2 commits into
coveragepy:mainfrom
itscloud0:fix-2168-ctrace-loop-branch

Conversation

@itscloud0

@itscloud0 itscloud0 commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • fix the missing loop-completion arc on Python 3.14 when a break exits the final loop iteration immediately before function return
  • apply the same correction in both the C tracer and Python tracer
  • add a focused regression covering the break case

Problem

Fixes #2168.

coverage report -m could show a missing branch after a break-driven loop exit on Python 3.14 even though the code path was executed.

Solution

Record the current line as the final arc before emitting the function-exit arc when returning from a loop-completion path.

@itscloud0 itscloud0 marked this pull request as ready for review June 22, 2026 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3.14: uncovered branch for loop completion with break

1 participant