Jean-Paul Calderone <invalid@example.invalid> added the comment:

Since the main argument for not fixing this bug seems to be that it doesn't 
affect many users, it seems like I should comment here that the issue is 
affecting me.  A recently proposed addition to Twisted gets bitten by this 
case, resulting in a report of less than full test coverage when in fact the 
tests do exercise every line and branch of the change.

Perhaps it is too hard to add and maintain a no-optimizations feature for 
Python (although I agree with Ned that this would be a useful feature for many 
reasons, not just to fix this bug).  There are other possible solutions to the 
issue of inaccurate coverage reports though.

For example, Python could provide an API for determining which lines have code 
that might be executed.  coverage.py (and the stdlib trace.py) currently use 
the code object's lnotab to decide which lines might be executable.  Maybe that 
should omit "continue" lines that get jumped over.  If the line will never 
execute, it seems there is no need to have it in the lnotab.

Using the lnotab is something of a hack though, so it might also make sense to 
leave it alone but introduce an API to get the same information, but corrected 
for whatever peephole optimizations the interpreter happens to have.

As far as the "not a bug" arguments go, I don't think it matters much whether 
you ultimately decide to call it a bug or a feature request.  It *is* clearly a 
useful feature to some people though, and rejecting the requested behavior as 
"not a bug" doesn't help anyone.  So call it a feature request if that makes it 
more palletable. :)

----------
nosy: +exarkun
resolution: wont fix -> 
status: closed -> open

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue2506>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to