Additional try except test case and fix

This commit is contained in:
Xinlong Hu
2025-07-03 12:55:31 -05:00
parent 55e71d2185
commit 3ee41410ae
2 changed files with 18 additions and 2 deletions
@@ -631,8 +631,8 @@ class TryElse3_6(ControlFlowTemplate):
try_header=~N("try_body").with_cond(exact_instructions("SETUP_EXCEPT"), exact_instructions("SETUP_FINALLY")),
try_body=N("try_footer.", None, "except_body"),
try_footer=~N("else_body").with_in_deg(1),
except_body=~N("tail").with_in_deg(1).of_subtemplate(Except3_6),
else_body=~N("tail").with_in_deg(1),
except_body=~N("tail.").with_in_deg(1).of_subtemplate(Except3_6),
else_body=~N("tail.").with_in_deg(1),
tail=N.tail(),
)
+16
View File
@@ -407,6 +407,14 @@ def z_TryExceptReturn():
except:
print(2)
def z1_TryExceptReturn():
try:
print(1)
return 2
except:
print(2)
return 3
def aa_TryExceptReturnMulti():
try:
print(1)
@@ -423,6 +431,14 @@ def ab_TryExceptReturnNamed():
except A as a:
print(2)
def ab1_TryExceptReturnNamed():
try:
print(1)
return 2
except A as a:
print(2)
return 3
def ac_TryFinallyBareFallthrough():
try:
print(1)