Skip to content

Commit

Permalink
catch arithmetic exceptions on trunc and slice
Browse files Browse the repository at this point in the history
  • Loading branch information
SilenZcience committed Oct 4, 2023
1 parent 347adff commit 323c148
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cat_win/cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion cat_win/util/argparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 + ']'
Expand Down

0 comments on commit 323c148

Please sign in to comment.