From 27ce45d8e105d0c9f9286c3cab830590d4c7cea3 Mon Sep 17 00:00:00 2001 From: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Date: Sat, 8 Oct 2022 00:30:23 +0100 Subject: [PATCH] gh-92886: make test_ast pass with -O (assertions off) (GH-98058) -O does not strip docstrings. Automerge-Triggered-By: GH:iritkatriel --- Lib/test/test_dis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_dis.py b/Lib/test/test_dis.py index fc2862c61baadb..667b267d27a06a 100644 --- a/Lib/test/test_dis.py +++ b/Lib/test/test_dis.py @@ -1212,7 +1212,7 @@ def get_disassembly(self, func, lasti=-1, wrapper=True, **kwargs): 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.'"