Raymond Hettinger <[email protected]> added the comment:
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
----------
nosy: +rhettinger
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue42693>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com