mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
compiler: don't emit SyntaxWarning on const stmt
Issue #26204: the compiler doesn't emit SyntaxWarning warnings anymore when constant statements are ignored.
This commit is contained in:
parent
896632ea6b
commit
15a3095d64
5 changed files with 28 additions and 76 deletions
|
|
@ -3,7 +3,6 @@ import dis
|
|||
import os
|
||||
import sys
|
||||
import unittest
|
||||
import warnings
|
||||
import weakref
|
||||
|
||||
from test import support
|
||||
|
|
@ -240,10 +239,8 @@ class AST_Tests(unittest.TestCase):
|
|||
ast_tree = compile(i, "?", kind, ast.PyCF_ONLY_AST)
|
||||
self.assertEqual(to_tuple(ast_tree), o)
|
||||
self._assertTrueorder(ast_tree, (0, 0))
|
||||
with warnings.catch_warnings():
|
||||
warnings.filterwarnings('ignore', category=SyntaxWarning)
|
||||
with self.subTest(action="compiling", input=i, kind=kind):
|
||||
compile(ast_tree, "?", kind)
|
||||
with self.subTest(action="compiling", input=i, kind=kind):
|
||||
compile(ast_tree, "?", kind)
|
||||
|
||||
def test_slice(self):
|
||||
slc = ast.parse("x[::]").body[0].value.slice
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue