New submission from Ned Batchelder <n...@nedbatchelder.com>:

(Using CPython commit 6b1ac809b9)

This program never executes line 6, but tracing it claims that it does:

    a = b = x = y = z = 1
    if a == 1:
        if b == 1:
            x = 4
        else:
            y = 6
    else:
        z = 8
    assert (a, b, x, y, z) == (1, 1, 4, 1, 1)

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 @20
        line <string> 3 @28
        line <string> 4 @36
        line <string> 6 @40
        line <string> 9 @52
        return <string> 9 @76

----------
components: Interpreter Core
messages: 384222
nosy: Mark.Shannon, nedbat
priority: normal
severity: normal
status: open
title: Nested if/else gets phantom else trace (3.10)
versions: Python 3.10

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

Reply via email to