diff --git a/Lib/test/test_dis.py b/Lib/test/test_dis.py index fc2862c61ba..667b267d27a 100644 --- a/Lib/test/test_dis.py +++ b/Lib/test/test_dis.py @@ -1212,7 +1212,7 @@ class DisWithFileTests(DisTests): return output.getvalue() -if sys.flags.optimize: +if dis.code_info.__doc__ is None: code_info_consts = "0: None" else: code_info_consts = "0: 'Formatted details of methods, functions, or code.'"