New submission from Ned Batchelder <n...@nedbatchelder.com>:
(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. ---------- components: Interpreter Core messages: 384178 nosy: Mark.Shannon, nedbat priority: normal severity: normal status: open title: Traced line number is wrong for "if not __debug__" versions: Python 3.10 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue42803> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com