mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
gh-114083: apply optimization of LOAD_CONST instructions to the whole CFG before optimize_basic_block. (#114408)
This commit is contained in:
parent
a53e56e7d8
commit
ed30a3c337
3 changed files with 192 additions and 144 deletions
|
@ -449,9 +449,17 @@ class TestSpecifics(unittest.TestCase):
|
|||
compile('if (5 if 5 else T): 0', '<eval>', 'exec')
|
||||
|
||||
def test_condition_expression_with_redundant_comparisons_compiles(self):
|
||||
# See gh-113054
|
||||
with self.assertWarns(SyntaxWarning):
|
||||
compile('if 9<9<9and 9or 9:9', '<eval>', 'exec')
|
||||
# See gh-113054, gh-114083
|
||||
exprs = [
|
||||
'if 9<9<9and 9or 9:9',
|
||||
'if 9<9<9and 9or 9or 9:9',
|
||||
'if 9<9<9and 9or 9or 9or 9:9',
|
||||
'if 9<9<9and 9or 9or 9or 9or 9:9',
|
||||
]
|
||||
for expr in exprs:
|
||||
with self.subTest(expr=expr):
|
||||
with self.assertWarns(SyntaxWarning):
|
||||
compile(expr, '<eval>', 'exec')
|
||||
|
||||
def test_dead_code_with_except_handler_compiles(self):
|
||||
compile(textwrap.dedent("""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue