Author Mark.Shannon
Recipients Mark.Shannon, nedbat, rhettinger, serhiy.storchaka
Date 2020-12-21.10:06:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1608545177.34.0.495752828959.issue42693@roundup.psfhosted.org>
In-reply-to
Content
Yes, this is change is deliberate.

PEP 626 states that *all* executed code gets traced.
Occasionally that will result in NOPs in the code, that are necessary 
for correctness, but cannot be removed by the optimizer.
Is this a problem in practice?

In fact this NOP can be removed by rewriting the bytecode to:

  2           0 LOAD_CONST               0 (10)
              2 STORE_NAME               0 (x)

  3           4 LOAD_CONST               3 (20)

  5           6 STORE_NAME               2 (y)
              8 LOAD_CONST               4 (None)
             10 RETURN_VALUE

but that is a relatively rare case where the proceeding or following instruction has no observable side-effects.
It is also non-trivial to implement, as the NOP and LOAD_CONST are in different basic blocks.
History
Date User Action Args
2020-12-21 10:06:17Mark.Shannonsetrecipients: + Mark.Shannon, rhettinger, nedbat, serhiy.storchaka
2020-12-21 10:06:17Mark.Shannonsetmessageid: <1608545177.34.0.495752828959.issue42693@roundup.psfhosted.org>
2020-12-21 10:06:17Mark.Shannonlinkissue42693 messages
2020-12-21 10:06:17Mark.Shannoncreate