This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author exarkun
Recipients ajaksu2, amaury.forgeotdarc, belopolsky, eric.araujo, exarkun, nedbat, rhettinger, terry.reedy
Date 2011-07-13.16:07:50
SpamBayes Score 0.0
Marked as misclassified No
Message-id <1310573271.72.0.662168239803.issue2506@psf.upfronthosting.co.za>
In-reply-to
Content
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. :)
History
Date User Action Args
2011-07-13 16:07:52exarkunsetrecipients: + exarkun, rhettinger, terry.reedy, amaury.forgeotdarc, belopolsky, ajaksu2, nedbat, eric.araujo
2011-07-13 16:07:51exarkunsetmessageid: <1310573271.72.0.662168239803.issue2506@psf.upfronthosting.co.za>
2011-07-13 16:07:51exarkunlinkissue2506 messages
2011-07-13 16:07:50exarkuncreate