Describe the bug
In python 3.14 there is a uncovered branch detected in for loops that have a conditional break and a statement thereafter, when using COVERAGE_CORE=ctrace.
To Reproduce
def foo(*x):
for i in x:
if i:
break
pass
foo()
foo(0)
foo(1)
The coverage shows for line 2: line 2 didn't jump to line 5 because the loop on line 2 didn't complete
Versions:
- CPython: 3.14.4
- coverage: 7.13.5
- pytest: 9.0.3
- pytest-cov: 7.1.0
Expected behavior
The line should be considered covered, since e.g. foo(0) will exhaust the loop.
It works correctly if:
- using CPython 3.13.3
- using
COVERAGE_CORE=sysmon (or no override)
- if there is a statement after the
if within the for loop
- if there is no statement after the
for loop
- if the
for loop has an else branch
Additional context
This may be related to: #1987
Describe the bug
In python 3.14 there is a uncovered branch detected in for loops that have a conditional break and a statement thereafter, when using
COVERAGE_CORE=ctrace.To Reproduce
The coverage shows for line 2:
line 2 didn't jump to line 5 because the loop on line 2 didn't completeVersions:
Expected behavior
The line should be considered covered, since e.g.
foo(0)will exhaust the loop.It works correctly if:
COVERAGE_CORE=sysmon(or no override)ifwithin theforloopforloopforloop has anelsebranchAdditional context
This may be related to: #1987