From f4cd3eadc086eb9fe44f52bfb69a51f3cfdbd9cc Mon Sep 17 00:00:00 2001 From: Xinlong Hu Date: Mon, 15 Dec 2025 14:20:41 -0600 Subject: [PATCH] editing header to adjust for <3.12 versions --- pylingual/control_flow_reconstruction/templates/Block.py | 2 +- .../control_flow_reconstruction/templates/Conditional.py | 4 ++-- pylingual/control_flow_reconstruction/templates/Loop.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pylingual/control_flow_reconstruction/templates/Block.py b/pylingual/control_flow_reconstruction/templates/Block.py index 8866a5c..19f0b38 100644 --- a/pylingual/control_flow_reconstruction/templates/Block.py +++ b/pylingual/control_flow_reconstruction/templates/Block.py @@ -66,7 +66,7 @@ class RemoveUnreachable(ControlFlowTemplate): return node -@register_template(0, 0, (3, 12), (3, 13)) +@register_template(0, 0, *versions_from(3, 12)) class JumpTemplate(ControlFlowTemplate): template = T( body=~N("jump", None).with_cond(without_instructions("CLEANUP_THROW")), diff --git a/pylingual/control_flow_reconstruction/templates/Conditional.py b/pylingual/control_flow_reconstruction/templates/Conditional.py index f5bdb95..341e3c6 100644 --- a/pylingual/control_flow_reconstruction/templates/Conditional.py +++ b/pylingual/control_flow_reconstruction/templates/Conditional.py @@ -1,5 +1,5 @@ from ..cft import ControlFlowTemplate, EdgeKind, MetaTemplate, register_template -from ..utils import E, T, N, defer_source_to, has_some_lines, run_is, has_no_lines, with_instructions, exact_instructions, has_instval, starting_instructions, to_indented_source, make_try_match, without_top_level_instructions, ending_instructions +from ..utils import E, T, N, defer_source_to, has_some_lines, run_is, has_no_lines, versions_from, with_instructions, exact_instructions, has_instval, starting_instructions, to_indented_source, make_try_match, without_top_level_instructions, ending_instructions from .Loop import BreakTemplate, ContinueTemplate class EarlyRet(ControlFlowTemplate): @@ -80,7 +80,7 @@ class IfElseJump(ControlFlowTemplate): """ -@register_template(1, 39, (3, 12), (3, 13)) +@register_template(1, 39, *versions_from(3, 12)) class IfElseLoop(ControlFlowTemplate): template = T( if_header=~N("else_body", "if_body").with_cond(without_top_level_instructions("WITH_EXCEPT_START", "CHECK_EXC_MATCH", "FOR_ITER")), diff --git a/pylingual/control_flow_reconstruction/templates/Loop.py b/pylingual/control_flow_reconstruction/templates/Loop.py index cc939f7..9cb9620 100644 --- a/pylingual/control_flow_reconstruction/templates/Loop.py +++ b/pylingual/control_flow_reconstruction/templates/Loop.py @@ -181,7 +181,7 @@ class WhileElse3_10(ControlFlowTemplate): """ -@register_template(0, 1, (3, 12), (3, 13)) +@register_template(0, 1, *versions_from(3, 12)) class WhileElse3_12(ControlFlowTemplate): template = T( while_header=~N("while_body", "else_body"),