Skip to content

Commit dcff99e

Browse files
committed
fix:Blockly Python modules do not perform exit checks on special grammar words
1 parent 635166c commit dcff99e

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

xarm/tools/blockly/_blockly_handler.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1117,7 +1117,9 @@ def _handle_python_code(self, block, indent=0, arg_map=None, **kwargs):
11171117
prev_is_empty = True
11181118
else:
11191119
prev_is_empty = False
1120-
if (self._is_exec or (not self._is_exec and not self._is_ide)) and code.strip():
1120+
if (self._is_exec or (not self._is_exec and not self._is_ide)) and code.strip() and code not in \
1121+
['finally:', 'else:'] and all([i not in code for i in ['elif', 'except', 'def', 'class']]) \
1122+
and not code.startswith('@')::
11211123
code_indent = re.match('(\s*).*', code).group(1)
11221124
self._append_main_code(code_indent + 'if not self.is_alive:', indent + 2)
11231125
self._append_main_code(code_indent + 'return', indent + 3)

xarm/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '1.14.3'
1+
__version__ = '1.14.4'

0 commit comments

Comments
 (0)