mirror of
https://github.com/syssec-utd/pylingual.git
synced 2026-05-10 18:39:03 -07:00
Additional try except test case and fix
This commit is contained in:
@@ -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(),
|
||||
)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user