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:
Victor Stinner 2016-02-08 22:45:06 +01:00
parent 896632ea6b
commit 15a3095d64
5 changed files with 28 additions and 76 deletions

View file

@ -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