diff options
author | Irit Katriel <1055913+iritkatriel@users.noreply.github.com> | 2024-01-03 16:57:48 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-03 16:57:48 (GMT) |
commit | 7d01fb48089872155e1721ba0a8cc27ee5c4fecd (patch) | |
tree | a9fa94eba842ae6785ff5451568add173dca11af /Lib/test/test_compile.py | |
parent | 0c3455a9693cfabcd991c4c33db7cccb1387de58 (diff) | |
download | cpython-7d01fb48089872155e1721ba0a8cc27ee5c4fecd.zip cpython-7d01fb48089872155e1721ba0a8cc27ee5c4fecd.tar.gz cpython-7d01fb48089872155e1721ba0a8cc27ee5c4fecd.tar.bz2 |
gh-113603: Compiler no longer tries to maintain the no-empty-block invariant (#113636)
Diffstat (limited to 'Lib/test/test_compile.py')
-rw-r--r-- | Lib/test/test_compile.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py index 906e16c..7850977 100644 --- a/Lib/test/test_compile.py +++ b/Lib/test/test_compile.py @@ -448,6 +448,19 @@ class TestSpecifics(unittest.TestCase): # See gh-113054 compile('if (5 if 5 else T): 0', '<eval>', 'exec') + def test_condition_expression_with_redundant_comparisons_compiles(self): + # See gh-113054 + compile('if 9<9<9and 9or 9:9', '<eval>', 'exec') + + def test_dead_code_with_except_handler_compiles(self): + compile(textwrap.dedent(""" + if None: + with CM: + x = 1 + else: + x = 2 + """), '<eval>', 'exec') + def test_compile_invalid_namedexpr(self): # gh-109351 m = ast.Module( |