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 nedbat
Recipients Mark.Shannon, nedbat
Date 2021-01-01.14:43:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1609512183.17.0.454209386156.issue42803@roundup.psfhosted.org>
In-reply-to
Content
(Using CPython commit 6b1ac809b9)

This program never executes line 4, but the "if not __debug__" is partly attributed to line 4, giving an incorrect trace:

    for value in [True, False]:
        if value:
            if not __debug__:
                1/0 # line 4
        else:
            x = 6

Using a simple trace program (https://github.com/nedbat/coveragepy/blob/master/lab/run_trace.py), it produces this output:

    call <string> 1 @-1
        line <string> 1 @0
        line <string> 2 @8
        line <string> 3 @12
        line <string> 4 @14
        line <string> 1 @4
        line <string> 2 @8
        line <string> 6 @16
        line <string> 1 @4
        return <string> 1 @24

Various simplifications of the program make the problem go away.
History
Date User Action Args
2021-01-01 14:43:03nedbatsetrecipients: + nedbat, Mark.Shannon
2021-01-01 14:43:03nedbatsetmessageid: <1609512183.17.0.454209386156.issue42803@roundup.psfhosted.org>
2021-01-01 14:43:03nedbatlinkissue42803 messages
2021-01-01 14:43:03nedbatcreate