From 323c148cfe16710240bd3f077ccd2f55bb1df966 Mon Sep 17 00:00:00 2001 From: Silas Kraume Date: Thu, 5 Oct 2023 00:01:04 +0200 Subject: [PATCH] catch arithmetic exceptions on trunc and slice --- cat_win/cat.py | 2 +- cat_win/util/argparser.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cat_win/cat.py b/cat_win/cat.py index edd485ba..1cadcce9 100644 --- a/cat_win/cat.py +++ b/cat_win/cat.py @@ -660,7 +660,7 @@ def edit_content(content: list, show_bytecode: bool, file_index: int = 0, try: content = [(prefix, eval(repr(line) + param)) for prefix, line in content] - except (SyntaxError, NameError, ValueError): + except (SyntaxError, NameError, ValueError, ArithmeticError): err_print('Error at operation: ', param) return diff --git a/cat_win/util/argparser.py b/cat_win/util/argparser.py index ae075a49..35350875 100644 --- a/cat_win/util/argparser.py +++ b/cat_win/util/argparser.py @@ -213,7 +213,7 @@ def _add_argument(self, param: str, delete: bool = False) -> bool: for i, p_split in enumerate(param[6:].split(':')): try: self.file_truncate[i] = int(eval(p_split)) - except (SyntaxError, NameError, ValueError): + except (SyntaxError, NameError, ValueError, ArithmeticError): self.file_truncate[i] = None return False # '[' + ARGS_CUT + ']'