From 97123891bf2456ec6c73be55ec5f44cbcab7a2fb Mon Sep 17 00:00:00 2001 From: Xinlong Hu Date: Fri, 1 Aug 2025 20:05:34 -0500 Subject: [PATCH] Exception fail_body matching adjustment --- .../templates/Exception.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pylingual/control_flow_reconstruction/templates/Exception.py b/pylingual/control_flow_reconstruction/templates/Exception.py index 1956553..b6141f3 100644 --- a/pylingual/control_flow_reconstruction/templates/Exception.py +++ b/pylingual/control_flow_reconstruction/templates/Exception.py @@ -292,14 +292,14 @@ class TryFinally3_11(ControlFlowTemplate): try_header=N("try_body"), try_body=N("finally_body", None, "fail_body"), finally_body=~N("tail.").with_in_deg(1).with_cond(no_back_edges), - fail_body=N(E.exc("reraise")).with_cond(ending_instructions("POP_TOP", "RERAISE"), ending_instructions("DELETE_SUBSCR", "RERAISE")), + fail_body=N(E.exc("reraise")).with_cond(without_top_level_instructions("DELETE_FAST")), reraise=reraise, tail=N.tail(), ) template2 = T( try_except=N("finally_body", None, "fail_body").of_type(Try3_11, TryElse3_11, Try3_12, TryElse3_12), finally_body=~N("tail.").with_in_deg(1).with_cond(no_back_edges), - fail_body=N(E.exc("reraise")).with_cond(ending_instructions("POP_TOP", "RERAISE")), + fail_body=N(E.exc("reraise")).with_cond(without_top_level_instructions("DELETE_FAST")), reraise=reraise, tail=N.tail(), ) @@ -531,14 +531,14 @@ class TryFinally3_9(ControlFlowTemplate): try_header=N("try_body"), try_body=N("finally_body", None, "fail_body"), finally_body=~N("tail.").with_in_deg(1).with_cond(no_back_edges), - fail_body=N("tail.").with_cond(ending_instructions("POP_TOP", "RERAISE"), ending_instructions("DELETE_SUBSCR", "RERAISE")), + fail_body=N("tail.").with_cond(without_top_level_instructions("DELETE_FAST")), tail=N.tail(), ) template2 = T( try_except=N("finally_tail", None, "fail_body").of_type(TryElse3_9, Try3_9), finally_tail=N("finally_body", None, "fail_body"), finally_body=~N("tail.").with_in_deg(1).with_cond(no_back_edges), - fail_body=N("tail.").with_cond(ending_instructions("POP_TOP", "RERAISE")), + fail_body=N("tail.").with_cond(without_top_level_instructions("DELETE_FAST")), tail=N.tail(), ) @@ -790,14 +790,14 @@ class TryFinally3_6(ControlFlowTemplate): try_header=N("try_body"), try_body=N("finally_body", None, "fail_body"), finally_body=~N("fail_body").with_in_deg(1).with_cond(no_back_edges), - fail_body=N("tail.").with_cond(with_instructions("POP_TOP", "END_FINALLY"), with_instructions("LOAD_CONST", "RETURN_VALUE"), with_instructions("DELETE_SUBSCR", "END_FINALLY")), + fail_body=N("tail.").with_cond(without_top_level_instructions("DELETE_FAST")), tail=N.tail(), ) template2 = T( try_except=N("finally_tail", None, "fail_body").of_type(TryElse3_6, Try3_6, ReturnFinally3_6), finally_tail=N("finally_body", None, "fail_body"), finally_body=~N("fail_body").with_in_deg(1).with_cond(no_back_edges), - fail_body=N("tail.").with_cond(with_instructions("POP_TOP", "END_FINALLY"), with_instructions("LOAD_CONST", "RETURN_VALUE")), + fail_body=N("tail.").with_cond(without_top_level_instructions("DELETE_FAST")), tail=N.tail(), )