gh-124871: fix 'visited' tracking in compiler's reachability analysis (#124952)

This commit is contained in:
Irit Katriel 2024-10-04 17:37:38 +01:00 committed by GitHub
parent 994051e086
commit f474391b26
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 18 additions and 2 deletions

View file

@ -479,6 +479,19 @@ class TestSpecifics(unittest.TestCase):
x = 2
"""), '<eval>', 'exec')
def test_try_except_in_while_with_chained_condition_compiles(self):
# see gh-124871
compile(textwrap.dedent("""
name_1, name_2, name_3 = 1, 2, 3
while name_3 <= name_2 > name_1:
try:
raise
except:
pass
finally:
pass
"""), '<eval>', 'exec')
def test_compile_invalid_namedexpr(self):
# gh-109351
m = ast.Module(