Ned Batchelder <n...@nedbatchelder.com> added the comment:
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. ---------- status: closed -> open _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue42634> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com