Skip to content

Redundant NOP is generated in -OO mode #115347

Closed
@serhiy-storchaka

Description

@serhiy-storchaka

Run test_dis:

$ ./python -OO -m test -vuall test_dis ... ====================================================================== FAIL: test_disassemble_recursive (test.test_dis.DisTests.test_disassemble_recursive) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/serhiy/py/cpython/Lib/test/test_dis.py", line 1105, in test_disassemble_recursive check(dis_nested_1, depth=1) ~~~~~^^^^^^^^^^^^^^^^^^^^^^^ File "/home/serhiy/py/cpython/Lib/test/test_dis.py", line 1102, in check self.assertEqual(dis, expected) ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^ AssertionError: ' --[771 chars]\n 725 NOP\n\n 726 LOAD_GL[532 chars]UE\n' != ' --[771 chars]\n 726 LOAD_GLOBAL 1 (l[510 chars]UE\n' -- MAKE_CELL 0 (y) 723 RESUME 0 724 LOAD_FAST 0 (y) BUILD_TUPLE 1 LOAD_CONST 1 (<code object foo at 0x..., file "/home/serhiy/py/cpython/Lib/test/test_dis.py", line 724>) MAKE_FUNCTION SET_FUNCTION_ATTRIBUTE 8 (closure) STORE_FAST 1 (foo) 727 LOAD_FAST 1 (foo) RETURN_VALUE Disassembly of <code object foo at 0x..., file "/home/serhiy/py/cpython/Lib/test/test_dis.py", line 724>: -- COPY_FREE_VARS 1 MAKE_CELL 0 (x) 724 RESUME 0 - 725 NOP - 726 LOAD_GLOBAL 1 (list + NULL) LOAD_FAST 0 (x) BUILD_TUPLE 1 LOAD_CONST 1 (<code object <genexpr> at 0x..., file "/home/serhiy/py/cpython/Lib/test/test_dis.py", line 726>) MAKE_FUNCTION SET_FUNCTION_ATTRIBUTE 8 (closure) LOAD_DEREF 1 (y) GET_ITER CALL 0 CALL 1 RETURN_VALUE 

Linked PRs

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions