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 2020-12-20.20:45:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1608497149.25.0.210577864889.issue42634@roundup.psfhosted.org>
In-reply-to
Content
I checked on this with CPython commit c95f8bc270.  The code above is fixed, but this code has a similar problem:

a, b, c = 1, 1, 1
try:
    try:
        a = 4/0         # ZeroDivisionError
    except ValueError:
        b = 6
    except IndexError:
        a = 8           # Line 8
    finally:
        c = 10
except ZeroDivisionError:
    pass
assert a == 1 and b == 1 and c == 10


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 @10
    line <string> 3 @12
    line <string> 4 @16
    exception <string> 4 @20
    line <string> 5 @28
    line <string> 7 @48
    line <string> 8 @68
    line <string> 10 @78
    line <string> 11 @88
    line <string> 12 @100
    line <string> 13 @106
    return <string> 13 @136

Line 8 should never be executed.
History
Date User Action Args
2020-12-20 20:45:49nedbatsetrecipients: + nedbat, Mark.Shannon
2020-12-20 20:45:49nedbatsetmessageid: <1608497149.25.0.210577864889.issue42634@roundup.psfhosted.org>
2020-12-20 20:45:49nedbatlinkissue42634 messages
2020-12-20 20:45:49nedbatcreate