Skip to content

Commit

Permalink
Catch OverflowError when casting large ints to floats (#95).
Browse files Browse the repository at this point in the history
Co-authored-by: Jendrik Seipp <jendrik.seipp@liu.se>
  • Loading branch information
Silvan Sievers and jendrikseipp committed Mar 23, 2021
1 parent b1d8109 commit 16d8b34
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion downward/reports/compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def collect(self, table, cells):
values = [table[row_name].get(col_name, None) for col_name in col_names]
try:
diff = float(values[1]) - float(values[0])
except (ValueError, TypeError):
except (ValueError, TypeError, OverflowError):
diff = None
if diff is not None:
non_none_values.append(diff)
Expand Down
5 changes: 4 additions & 1 deletion lab/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,10 @@ def get_colors(cells, min_wins):
min_wins = True

# If we land here, both min_value and max_value are not None.
diff = float(max_value - min_value)
try:
diff = float(max_value - min_value)
except OverflowError:
return result

for col, val in cells.items():
if val is not None:
Expand Down

0 comments on commit 16d8b34

Please sign in to comment.