Fixing some try edge cases

This commit is contained in:
Tim Sweet
2025-06-16 12:55:02 -05:00
parent bc898b2c4e
commit bc3fc5d278
@@ -118,7 +118,6 @@ class TryElse3_12(ControlFlowTemplate):
@register_template(0, 1, (3, 10))
class Try3_10(ControlFlowTemplate):
template = T(
try_header=~N("try_body"),
try_body=N("try_footer.", None, "except_body"),
try_footer=~N("tail."),
except_body=~N("tail.").of_subtemplate(Except3_10),
@@ -130,7 +129,6 @@ class Try3_10(ControlFlowTemplate):
{
EdgeKind.Fall: "tail",
},
"try_header",
"try_body",
"except_body",
"try_footer",
@@ -140,7 +138,6 @@ class Try3_10(ControlFlowTemplate):
@to_indented_source
def to_indented_source():
"""
{try_header}
try:
{try_body}
{except_body}
@@ -149,7 +146,6 @@ class Try3_10(ControlFlowTemplate):
@register_template(0, 0, (3, 10))
class TryElse3_10(ControlFlowTemplate):
template = T(
try_header=N("try_body"),
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_10),
@@ -162,7 +158,6 @@ class TryElse3_10(ControlFlowTemplate):
{
EdgeKind.Fall: "tail",
},
"try_header",
"try_body",
"try_footer",
"except_body",
@@ -173,7 +168,6 @@ class TryElse3_10(ControlFlowTemplate):
@to_indented_source
def to_indented_source():
"""
{try_header}
try:
{try_body}
{except_body}
@@ -206,7 +200,7 @@ class NamedExc3_10(ExcBody3_10):
class BareExcept3_10(Except3_10):
template = T(
except_body=~N("tail.", None).of_type(BlockTemplate).with_cond(with_instructions("POP_EXCEPT")),
except_body=~N("tail.", None).of_type(BlockTemplate).with_cond(with_instructions("POP_EXCEPT"), with_instructions("RAISE_VARARGS")),
tail=N.tail(),
)