Author rhettinger
Recipients Mark.Shannon, nedbat, rhettinger, serhiy.storchaka
Date 2020-12-20.21:25:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1608499546.34.0.509380732611.issue42693@roundup.psfhosted.org>
In-reply-to
Content
Confirmed.  There is bogus NOP in the code.

=======================================================================

Python 3.10.0a3+ (heads/master:17ef4319a3, Dec 18 2020, 09:35:26)
[Clang 12.0.0 (clang-1200.0.32.28)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from textwrap import dedent
>>> from dis import dis
>>> s = '''
        x = 10
        if 0:
                print('hello')
        y = 20
'''
>>> code = compile(dedent(s), '', 'exec')
>>> list(code.co_code)
[100, 0, 90, 0, 9, 0, 100, 3, 90, 2, 100, 4, 83, 0]
>>> dis(code)
  2           0 LOAD_CONST               0 (10)
              2 STORE_NAME               0 (x)

  3           4 NOP

  5           6 LOAD_CONST               3 (20)
              8 STORE_NAME               2 (y)
             10 LOAD_CONST               4 (None)
             12 RETURN_VALUE
History
Date User Action Args
2020-12-20 21:25:46rhettingersetrecipients: + rhettinger, nedbat, Mark.Shannon, serhiy.storchaka
2020-12-20 21:25:46rhettingersetmessageid: <1608499546.34.0.509380732611.issue42693@roundup.psfhosted.org>
2020-12-20 21:25:46rhettingerlinkissue42693 messages
2020-12-20 21:25:46rhettingercreate