[Python-checkins] gh-96276: suppress SyntaxWarning in test_compile (GH-96277)
iritkatriel
webhook-mailer at python.org
Thu Aug 25 17:23:17 EDT 2022
https://github.com/python/cpython/commit/1e743616ac3f9466bc50768ecaf0860116bf4e59
commit: 1e743616ac3f9466bc50768ecaf0860116bf4e59
branch: main
author: Irit Katriel <1055913+iritkatriel at users.noreply.github.com>
committer: iritkatriel <1055913+iritkatriel at users.noreply.github.com>
date: 2022-08-25T22:23:06+01:00
summary:
gh-96276: suppress SyntaxWarning in test_compile (GH-96277)
files:
M Lib/test/test_compile.py
diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py
index c64e4e55f44..d7b78f686ef 100644
--- a/Lib/test/test_compile.py
+++ b/Lib/test/test_compile.py
@@ -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,7 +1232,9 @@ def 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,
More information about the Python-checkins
mailing list