From: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Date: Thu, 25 Aug 2022 21:23:06 +0000 (+0100) Subject: gh-96276: suppress SyntaxWarning in test_compile (GH-96277) X-Git-Tag: v3.12.0a1~562 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1e743616ac3f9466bc50768ecaf0860116bf4e59;p=thirdparty%2FPython%2Fcpython.git gh-96276: suppress SyntaxWarning in test_compile (GH-96277) --- diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py index c64e4e55f444..d7b78f686ef8 100644 --- a/Lib/test/test_compile.py +++ b/Lib/test/test_compile.py @@ -8,6 +8,7 @@ import _ast import tempfile import types import textwrap +import warnings from test import support from test.support import script_helper, requires_debug_ranges from test.support.os_helper import FakePath @@ -1231,7 +1232,9 @@ f( with self.subTest(body): namespace = {} source = textwrap.dedent(source_template.format(body)) - exec(source, namespace) + with warnings.catch_warnings(): + warnings.simplefilter('ignore', SyntaxWarning) + exec(source, namespace) code = namespace["f"].__code__ self.assertOpcodeSourcePositionIs( code,