Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-136438: Make suretest_dis pass with all optimization levels#136593

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
efimov-mikhail wants to merge2 commits intopython:main
base:main
Choose a base branch
Loading
fromefimov-mikhail:issue-136438-test_dis

Conversation

efimov-mikhail
Copy link
Contributor

@efimov-mikhailefimov-mikhail commentedJul 12, 2025
edited by bedevere-appbot
Loading

Now tests pass with all combinations of -OO and --without-doc-strings.

Before:

======================================================================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

@bedevere-appbedevere-appbot mentioned this pull requestJul 12, 2025
8 tasks
@bedevere-appbedevere-appbot added the testsTests in the Lib/test dir labelJul 12, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@sobolevnsobolevnAwaiting requested review from sobolevn

Assignees
No one assigned
Labels
awaiting reviewskip newstestsTests in the Lib/test dir
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@efimov-mikhail@picnixz

[8]ページ先頭

©2009-2025 Movatter.jp