From 84ffb3e0bc91bd90d6f773a31f2d05bca2c549b6 Mon Sep 17 00:00:00 2001 From: drospierski24 Date: Wed, 9 Jul 2025 10:43:30 -0500 Subject: [PATCH] 3.6 handles TryFinallyBareReturn --- pylingual/control_flow_reconstruction/templates/Exception.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pylingual/control_flow_reconstruction/templates/Exception.py b/pylingual/control_flow_reconstruction/templates/Exception.py index a785231..1ec2159 100644 --- a/pylingual/control_flow_reconstruction/templates/Exception.py +++ b/pylingual/control_flow_reconstruction/templates/Exception.py @@ -687,14 +687,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")), + fail_body=N("tail.").with_cond(with_instructions("POP_TOP", "END_FINALLY"),with_instructions("LOAD_CONST", "RETURN_VALUE")), tail=N.tail(), ) template2 = T( try_except=N("finally_tail", None, "fail_body").of_type(TryElse3_6, Try3_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")), + fail_body=N("tail.").with_cond(with_instructions("POP_TOP", "END_FINALLY"),with_instructions("LOAD_CONST", "RETURN_VALUE")), tail=N.tail(), ) @@ -731,3 +731,4 @@ class TryFinally3_6(ControlFlowTemplate): after = [] return list(chain(header, self.line("try:"), body, self.line("finally:"), in_finally, after)) + \ No newline at end of file