You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally reported byAndrew Svetlov (Bitbucket: asvetlov, GitHub: asvetlov)
When I've tried to make coverage for code like this:
#!python
def f(a):
while True:
a -= 1
if a==0:
pass
else:
continue
break
f(2)
I'd got report that line with continue statement is never executed. That's definitely not true.
I used branched coverage:
coverage3 run --branch cov.py
coverage3 html
I'd got this problem when had worked on tulip, minimal stripped example that I published can reproduce error easy.
Looks like tracer actually has never called with line for 'continue', that's how python works.
Andrew, unfortunately this is an artifact of the peephole optimizer.
If you believe as I do that it would be useful to have a way to disable the peephole optimizer so that these sorts of analyses would give useful results, comment on this CPython ticket: http://bugs.python.org/issue2506 "Add mechanism to disable optimizations".
Originally reported by Andrew Svetlov (Bitbucket: asvetlov, GitHub: asvetlov)
When I've tried to make coverage for code like this:
I'd got report that line with continue statement is never executed. That's definitely not true.
I used branched coverage:
coverage3 run --branch cov.py
coverage3 html
I'd got this problem when had worked on tulip, minimal stripped example that I published can reproduce error easy.
Looks like tracer actually has never called with line for 'continue', that's how python works.
Thoughts?
The text was updated successfully, but these errors were encountered: