]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-136438: Make sure `test_dis` pass with all optimization levels (GH-136593)
authorMikhail Efimov <efimov.mikhail@gmail.com>
Tue, 19 Aug 2025 08:48:35 +0000 (11:48 +0300)
committerGitHub <noreply@github.com>
Tue, 19 Aug 2025 08:48:35 +0000 (10:48 +0200)
Now tests pass with all combinations of -OO and --without-doc-strings.

Lib/test/test_dis.py

index fb47345857f1f8f29e8474d9b48b3028839c0ede..3e7477487200d09777989853c7c8beadf37d936c 100644 (file)
@@ -830,7 +830,7 @@ Disassembly of <code object foo at 0x..., file "%s", line %d>:
 %4d           LOAD_GLOBAL              1 (list + NULL)
                LOAD_FAST_BORROW         0 (x)
                BUILD_TUPLE              1
-               LOAD_CONST               1 (<code object <genexpr> at 0x..., file "%s", line %d>)
+               LOAD_CONST               %d (<code object <genexpr> at 0x..., file "%s", line %d>)
                MAKE_FUNCTION
                SET_FUNCTION_ATTRIBUTE   8 (closure)
                LOAD_DEREF               1 (y)
@@ -842,6 +842,7 @@ Disassembly of <code object foo at 0x..., file "%s", line %d>:
        _h.__code__.co_firstlineno + 1,
        _h.__code__.co_firstlineno + 1,
        _h.__code__.co_firstlineno + 3,
+       1 if __debug__ else 0,
        __file__,
        _h.__code__.co_firstlineno + 3,
 )
@@ -1468,7 +1469,7 @@ Positional-only arguments: 0
 Kw-only arguments: 0
 Number of locals:  1
 Stack size:        \\d+
-Flags:             OPTIMIZED, NEWLOCALS, HAS_DOCSTRING
+Flags:             OPTIMIZED, NEWLOCALS(, HAS_DOCSTRING)?
 Constants:
    {code_info_consts}
 Names: