summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2022-08-25 21:23:06 (GMT)
committerGitHub <noreply@github.com>2022-08-25 21:23:06 (GMT)
commit1e743616ac3f9466bc50768ecaf0860116bf4e59 (patch)
tree7d9fc8eb3a0049c3a0c7e4e7b0ca2f86b77decc5
parent1288097088dcf3bad3799bd5867e7675515a5b18 (diff)
downloadcpython-1e743616ac3f9466bc50768ecaf0860116bf4e59.zip
cpython-1e743616ac3f9466bc50768ecaf0860116bf4e59.tar.gz
cpython-1e743616ac3f9466bc50768ecaf0860116bf4e59.tar.bz2
gh-96276: suppress SyntaxWarning in test_compile (GH-96277)
-rw-r--r--Lib/test/test_compile.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py
index c64e4e5..d7b78f6 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,