8000 gh-96276: suppress SyntaxWarning in test_compile (GH-96277) · python/cpython@1e74361 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1e74361

Browse files
authored
gh-96276: suppress SyntaxWarning in test_compile (GH-96277)
1 parent 1288097 commit 1e74361

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Lib/test/test_compile.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import tempfile
99
import types
1010
import textwrap
11+
import warnings
1112
from test import support
1213
from test.support import script_helper, requires_debug_ranges
1314
from test.support.os_helper import FakePath
@@ -1231,7 +1232,9 @@ def f():
12311232
with self.subTest(body):
12321233
namespace = {}
12331234
source = textwrap.dedent(source_template.format(body))
1234-
exec(source, namespace)
1235+
with warnings.catch_warnings():
1236+
warnings.simplefilter('ignore', SyntaxWarning)
1237+
exec(source, namespace)
12351238
code = namespace["f"].__code__
12361239
self.assertOpcodeSourcePositionIs(
12371240
code,

0 commit comments

Comments
 (0)