diff --git a/Lib/test/test_dis.py b/Lib/test/test_dis.py index a19cf49e658ec5..e42bdac4e40330 100644 --- a/Lib/test/test_dis.py +++ b/Lib/test/test_dis.py @@ -1041,11 +1041,6 @@ def get_disassembly(self, func, lasti=-1, wrapper=True, **kwargs): return output.getvalue() -if sys.flags.optimize: - code_info_consts = "0: None" -else: - code_info_consts = "0: 'Formatted details of methods, functions, or code.'" - code_info_code_info = f"""\ Name: code_info Filename: (.*) @@ -1056,7 +1051,7 @@ def get_disassembly(self, func, lasti=-1, wrapper=True, **kwargs): Stack size: \\d+ Flags: OPTIMIZED, NEWLOCALS Constants: - {code_info_consts} + 0: 'Formatted details of methods, functions, or code.' Names: 0: _format_code_info 1: _get_code_object diff --git a/Misc/NEWS.d/next/Tests/2022-05-25-23-14-09.gh-issue-92886.z99rtj.rst b/Misc/NEWS.d/next/Tests/2022-05-25-23-14-09.gh-issue-92886.z99rtj.rst new file mode 100644 index 00000000000000..ff83f1bfabe63b --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2022-05-25-23-14-09.gh-issue-92886.z99rtj.rst @@ -0,0 +1 @@ +Fixing tests that fail when running with optimizations (``-O``) in ``test_dis.py``.