From: sobolevn Date: Thu, 10 Jul 2025 08:57:29 +0000 (+0300) Subject: gh-136438: Make sure `test_builtins` pass with all optimization levels (#136474) X-Git-Tag: v3.15.0a1~1028 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c17654334946b232aa296696cf70ec93a09d8156;p=thirdparty%2FPython%2Fcpython.git gh-136438: Make sure `test_builtins` pass with all optimization levels (#136474) --- diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py index 14fe33552396..8830641f0abd 100644 --- a/Lib/test/test_builtin.py +++ b/Lib/test/test_builtin.py @@ -436,7 +436,7 @@ class BuiltinTest(ComplexesAreIdenticalMixin, unittest.TestCase): # test both direct compilation and compilation via AST codeobjs = [] codeobjs.append(compile(codestr, "", "exec", optimize=optval)) - tree = ast.parse(codestr) + tree = ast.parse(codestr, optimize=optval) codeobjs.append(compile(tree, "", "exec", optimize=optval)) for code in codeobjs: ns = {} @@ -624,7 +624,7 @@ class BuiltinTest(ComplexesAreIdenticalMixin, unittest.TestCase): for opt in [opt1, opt2]: opt_right = opt.value.right self.assertIsInstance(opt_right, ast.Constant) - self.assertEqual(opt_right.value, True) + self.assertEqual(opt_right.value, __debug__) def test_delattr(self): sys.spam = 1