[New-bugs-announce] [issue42693] "if 0:" lines are traced; they didn't use to be
Ned Batchelder
report at bugs.python.org
Sun Dec 20 16:06:08 EST 2020
New submission from Ned Batchelder <ned at nedbatchelder.com>:
(Using CPython commit c95f8bc270.)
This program has an "if 0:" line that becomes a NOP bytecode. It didn't used to in Python 3.9
print(1)
if 0: # line 2
print(3)
print(4)
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
1
line <string> 2 @8
line <string> 4 @10
4
return <string> 4 @20
Using Python3.9 gives this output:
call <string> 1 @-1
line <string> 1 @0
1
line <string> 4 @8
4
return <string> 4 @18
Is this change intentional?
----------
messages: 383452
nosy: Mark.Shannon, nedbat
priority: normal
severity: normal
status: open
title: "if 0:" lines are traced; they didn't use to be
type: behavior
versions: Python 3.10
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42693>
_______________________________________
More information about the New-bugs-announce
mailing list