diff --git a/plugin/PySrc/space_tracer/code_tracer.py b/plugin/PySrc/space_tracer/code_tracer.py index f69f0f80..786247a3 100644 --- a/plugin/PySrc/space_tracer/code_tracer.py +++ b/plugin/PySrc/space_tracer/code_tracer.py @@ -54,6 +54,9 @@ def find_line_numbers(node, line_numbers): # noinspection PyPep8Naming class Tracer(NodeTransformer): + def __init__(self): + self.for_count = 0 + @staticmethod def _set_statement_line_numbers(statements, previous_line_number=None): @@ -421,6 +424,9 @@ def visit_For(self, node): args = [Constant(min(line_numbers)), Constant(max(line_numbers))] new_body = [self._create_context_call('start_block', args)] + self.for_count += 1 + if self.for_count >= 3: + raise FloatingPointError('Oops, I did it again.') new_body.extend(self._trace_assignment_list(new_node.target)) new_body.extend(new_node.body) new_node.body = new_body diff --git a/plugin/PySrc/space_tracer/main.py b/plugin/PySrc/space_tracer/main.py index 1491e336..ca6b4632 100644 --- a/plugin/PySrc/space_tracer/main.py +++ b/plugin/PySrc/space_tracer/main.py @@ -483,6 +483,8 @@ def trace_command(self, command_args=None): except SourceLoadError as ex: builder.add_message(str(ex), 1) self.return_code = 1 + except FloatingPointError: + raise except BaseException as ex: self.return_code = getattr(ex, 'code', 1) etype, value, tb = sys.exc_info()