summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2024-10-04 16:37:38 (GMT)
committerGitHub <noreply@github.com>2024-10-04 16:37:38 (GMT)
commitf474391b26aa9208b44ca879f8635409d322f738 (patch)
tree0290f54d50ef8cb546cb4b6a7635a1294270551c /Lib
parent994051e086b9ce624a3b16750d6f692bc4a3b07b (diff)
downloadcpython-f474391b26aa9208b44ca879f8635409d322f738.zip
cpython-f474391b26aa9208b44ca879f8635409d322f738.tar.gz
cpython-f474391b26aa9208b44ca879f8635409d322f738.tar.bz2
gh-124871: fix 'visited' tracking in compiler's reachability analysis (#124952)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_compile.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py
index e9ee72c..e6dc7a5 100644
--- a/Lib/test/test_compile.py
+++ b/Lib/test/test_compile.py
@@ -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(