Now tests pass with all combinations of -OO and --without-doc-strings.
======================================================================FAIL: test_info (test.test_dis.BytecodeTests.test_info)----------------------------------------------------------------------Traceback (most recent call last): File "/home/sikko/projects/cpython/Lib/test/test_dis.py", line 2324, in test_info self.assertRegex(b.info(), expected) ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^AssertionError: Regex didn't match: 'Name: code_info\nFilename: (.*)\nArgument count: 1\nPositional-only arguments: 0\nKw-only arguments: 0\nNumber of locals: 1\nStack size: \\d+\nFlags: OPTIMIZED, NEWLOCALS, HAS_DOCSTRING\nConstants:\n 0: None\nNames:\n 0: _format_code_info\n 1: _get_code_object\nVariable names:\n 0: x' not found in 'Name: code_info\nFilename: /home/sikko/projects/cpython/Lib/dis.py\nArgument count: 1\nPositional-only arguments: 0\nKw-only arguments: 0\nNumber of locals: 1\nStack size: 5\nFlags: OPTIMIZED, NEWLOCALS\nConstants:\n 0: None\nNames:\n 0: _format_code_info\n 1: _get_code_object\nVariable names:\n 0: x'======================================================================FAIL: test_code_info (test.test_dis.CodeInfoTests.test_code_info)----------------------------------------------------------------------Traceback (most recent call last): File "/home/sikko/projects/cpython/Lib/test/test_dis.py", line 1625, in test_code_info self.assertRegex(dis.code_info(x), expected) ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^AssertionError: Regex didn't match: 'Name: code_info\nFilename: (.*)\nArgument count: 1\nPositional-only arguments: 0\nKw-only arguments: 0\nNumber of locals: 1\nStack size: \\d+\nFlags: OPTIMIZED, NEWLOCALS, HAS_DOCSTRING\nConstants:\n 0: None\nNames:\n 0: _format_code_info\n 1: _get_code_object\nVariable names:\n 0: x' not found in 'Name: code_info\nFilename: /home/sikko/projects/cpython/Lib/dis.py\nArgument count: 1\nPositional-only arguments: 0\nKw-only arguments: 0\nNumber of locals: 1\nStack size: 5\nFlags: OPTIMIZED, NEWLOCALS\nConstants:\n 0: None\nNames:\n 0: _format_code_info\n 1: _get_code_object\nVariable names:\n 0: x'======================================================================FAIL: test_show_code (test.test_dis.CodeInfoTests.test_show_code)----------------------------------------------------------------------Traceback (most recent call last): File "/home/sikko/projects/cpython/Lib/test/test_dis.py", line 1632, in test_show_code self.assertRegex(output.getvalue(), expected+"\n") ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^AssertionError: Regex didn't match: 'Name: code_info\nFilename: (.*)\nArgument count: 1\nPositional-only arguments: 0\nKw-only arguments: 0\nNumber of locals: 1\nStack size: \\d+\nFlags: OPTIMIZED, NEWLOCALS, HAS_DOCSTRING\nConstants:\n 0: None\nNames:\n 0: _format_code_info\n 1: _get_code_object\nVariable names:\n 0: x\n' not found in 'Name: code_info\nFilename: /home/sikko/projects/cpython/Lib/dis.py\nArgument count: 1\nPositional-only arguments: 0\nKw-only arguments: 0\nNumber of locals: 1\nStack size: 5\nFlags: OPTIMIZED, NEWLOCALS\nConstants:\n 0: None\nNames:\n 0: _format_code_info\n 1: _get_code_object\nVariable names:\n 0: x\n'======================================================================FAIL: test_disassemble_recursive (test.test_dis.DisTests.test_disassemble_recursive)----------------------------------------------------------------------Traceback (most recent call last): File "/home/sikko/projects/cpython/Lib/test/test_dis.py", line 1258, in test_disassemble_recursive check(dis_nested_1, depth=1) ~~~~~^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sikko/projects/cpython/Lib/test/test_dis.py", line 1255, in check self.assertEqual(dis, expected) ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^AssertionError: ' --[965 chars] 0 (<code object <genexpr> at 0x..., file [306 chars]UE\n' != ' --[965 chars] 1 (<code object <genexpr> at 0x..., file [306 chars]UE\n' -- MAKE_CELL 0 (y) 794 RESUME 0 795 LOAD_FAST_BORROW 0 (y) BUILD_TUPLE 1 LOAD_CONST 0 (<code object foo at 0x..., file "/home/sikko/projects/cpython/Lib/test/test_dis.py", line 795>) MAKE_FUNCTION SET_FUNCTION_ATTRIBUTE 8 (closure) STORE_FAST 1 (foo) 798 LOAD_FAST_BORROW 1 (foo) RETURN_VALUE Disassembly of <code object foo at 0x..., file "/home/sikko/projects/cpython/Lib/test/test_dis.py", line 795>: -- COPY_FREE_VARS 1 MAKE_CELL 0 (x) 795 RESUME 0 797 LOAD_GLOBAL 1 (list + NULL) LOAD_FAST_BORROW 0 (x) BUILD_TUPLE 1- LOAD_CONST 0 (<code object <genexpr> at 0x..., file "/home/sikko/projects/cpython/Lib/test/test_dis.py", line 797>)? ^+ LOAD_CONST 1 (<code object <genexpr> at 0x..., file "/home/sikko/projects/cpython/Lib/test/test_dis.py", line 797>)? ^ MAKE_FUNCTION SET_FUNCTION_ATTRIBUTE 8 (closure) LOAD_DEREF 1 (y) CALL 0 CALL 1 RETURN_VALUE======================================================================FAIL: test_disassemble_recursive (test.test_dis.DisWithFileTests.test_disassemble_recursive)----------------------------------------------------------------------Traceback (most recent call last): File "/home/sikko/projects/cpython/Lib/test/test_dis.py", line 1258, in test_disassemble_recursive check(dis_nested_1, depth=1) ~~~~~^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sikko/projects/cpython/Lib/test/test_dis.py", line 1255, in check self.assertEqual(dis, expected) ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^AssertionError: ' --[965 chars] 0 (<code object <genexpr> at 0x..., file [306 chars]UE\n' != ' --[965 chars] 1 (<code object <genexpr> at 0x..., file [306 chars]UE\n' -- MAKE_CELL 0 (y) 794 RESUME 0 795 LOAD_FAST_BORROW 0 (y) BUILD_TUPLE 1 LOAD_CONST 0 (<code object foo at 0x..., file "/home/sikko/projects/cpython/Lib/test/test_dis.py", line 795>) MAKE_FUNCTION SET_FUNCTION_ATTRIBUTE 8 (closure) STORE_FAST 1 (foo) 798 LOAD_FAST_BORROW 1 (foo) RETURN_VALUE Disassembly of <code object foo at 0x..., file "/home/sikko/projects/cpython/Lib/test/test_dis.py", line 795>: -- COPY_FREE_VARS 1 MAKE_CELL 0 (x) 795 RESUME 0 797 LOAD_GLOBAL 1 (list + NULL) LOAD_FAST_BORROW 0 (x) BUILD_TUPLE 1- LOAD_CONST 0 (<code object <genexpr> at 0x..., file "/home/sikko/projects/cpython/Lib/test/test_dis.py", line 797>)? ^+ LOAD_CONST 1 (<code object <genexpr> at 0x..., file "/home/sikko/projects/cpython/Lib/test/test_dis.py", line 797>)? ^ MAKE_FUNCTION SET_FUNCTION_ATTRIBUTE 8 (closure) LOAD_DEREF 1 (y) CALL 0 CALL 1 RETURN_VALUE
Uh oh!
There was an error while loading.Please reload this page.
Now tests pass with all combinations of -OO and --without-doc-strings.
Before:
-OO
#136438