From b6a1007a49af6f0053edba839c496ee65efd78cd Mon Sep 17 00:00:00 2001 From: Xinlong Hu <118075581+XinlongCS@users.noreply.github.com> Date: Thu, 3 Jul 2025 14:02:33 -0500 Subject: [PATCH] 3.6/3.7/3.8/3.9/3.10 Try except outside definition fix --- .../control_flow_reconstruction/templates/Exception.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pylingual/control_flow_reconstruction/templates/Exception.py b/pylingual/control_flow_reconstruction/templates/Exception.py index 715c1d0..206986d 100644 --- a/pylingual/control_flow_reconstruction/templates/Exception.py +++ b/pylingual/control_flow_reconstruction/templates/Exception.py @@ -388,10 +388,10 @@ class ExcBody3_9(ControlFlowTemplate): class NamedExc3_9(ExcBody3_9): template = T( - header=~N("body", None).with_cond(with_instructions("POP_TOP", "STORE_FAST")), + header=~N("body", None).with_cond(with_instructions("POP_TOP", "STORE_FAST"), with_instructions("POP_TOP", "STORE_NAME")), body=N("normal_cleanup.", None, "exception_cleanup"), - normal_cleanup=~N("tail.").with_cond(with_instructions("STORE_FAST", "DELETE_FAST")), - exception_cleanup=~N.tail().with_cond(with_instructions("STORE_FAST", "DELETE_FAST")), + normal_cleanup=~N("tail.").with_cond(with_instructions("STORE_FAST", "DELETE_FAST"), with_instructions("STORE_NAME", "DELETE_FAST")), + exception_cleanup=~N.tail().with_cond(with_instructions("STORE_FAST", "DELETE_FAST"), with_instructions("STORE_NAME", "DELETE_FAST")), tail=N.tail(), ) @@ -582,10 +582,10 @@ class ExcBody3_6(ControlFlowTemplate): class NamedExc3_6(ExcBody3_6): template = T( - header=~N("body", None).with_cond(starting_instructions("POP_TOP", "STORE_FAST")), + header=~N("body", None).with_cond(starting_instructions("POP_TOP", "STORE_FAST"), with_instructions("POP_TOP", "STORE_NAME")), body=N("normal_cleanup.", None, "exception_cleanup"), normal_cleanup=~N("exception_cleanup."), - exception_cleanup=~N("tail.").with_cond(with_instructions("LOAD_CONST", "STORE_FAST")), + exception_cleanup=~N("tail.").with_cond(with_instructions("LOAD_CONST", "STORE_FAST"), with_instructions("LOAD_CONST", "STORE_NAME")), tail=N.tail() )