From a28875ed00778f3fd467598b924858ebdeddec63 Mon Sep 17 00:00:00 2001 From: WangZhen <23097963+0x45f@users.noreply.github.com> Date: Fri, 7 Jul 2023 17:05:25 +0800 Subject: [PATCH] Polish remove_global_guarded_variable (#254) --- sot/opcode_translator/executor/opcode_executor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sot/opcode_translator/executor/opcode_executor.py b/sot/opcode_translator/executor/opcode_executor.py index 466b7c485..c23e8d28d 100644 --- a/sot/opcode_translator/executor/opcode_executor.py +++ b/sot/opcode_translator/executor/opcode_executor.py @@ -1766,7 +1766,6 @@ def FOR_ITER(self, instr): if not isinstance( iterator, (SequenceIterVariable, DictIterVariable) ): - self._graph.remove_global_guarded_variable(iterator) raise BreakGraphError() backup_iter_idx = iterator.idx self._inline_call_for_loop(iterator, instr) @@ -1774,6 +1773,7 @@ def FOR_ITER(self, instr): except BreakGraphError as e: if backup_iter_idx: iterator.idx = backup_iter_idx + self._graph.remove_global_guarded_variable(iterator) self._break_graph_in_for_loop(iterator, instr) return Stop()