From e4937926122a3b12b0b747a727424271e6c30bd5 Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Fri, 7 Oct 2022 22:02:38 -0700 Subject: [PATCH] gh-92886: make test_ast pass with -O (assertions off) (GH-98058) -O does not strip docstrings. Automerge-Triggered-By: GH:iritkatriel (cherry picked from commit 27ce45d8e105d0c9f9286c3cab830590d4c7cea3) Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> --- 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 6d16021a612051..6a0a2d92796703 100644 --- a/Lib/test/test_dis.py +++ b/Lib/test/test_dis.py @@ -1076,7 +1076,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.'"