mirror of
https://github.com/python/cpython
synced 2024-09-18 20:01:39 +00:00
gh-96276: suppress SyntaxWarning in test_compile (GH-96277)
This commit is contained in:
parent
1288097088
commit
1e743616ac
|
@ -8,6 +8,7 @@
|
|||
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,6 +1232,8 @@ def f():
|
|||
with self.subTest(body):
|
||||
namespace = {}
|
||||
source = textwrap.dedent(source_template.format(body))
|
||||
with warnings.catch_warnings():
|
||||
warnings.simplefilter('ignore', SyntaxWarning)
|
||||
exec(source, namespace)
|
||||
code = namespace["f"].__code__
|
||||
self.assertOpcodeSourcePositionIs(
|
||||
|
|
Loading…
Reference in a new issue