Skip to content

Commit

Permalink
fix: Handle IndexError when parse BinarySize (#2962) (#2963)
Browse files Browse the repository at this point in the history
Co-authored-by: Sanghun Lee <sanghun@lablup.com>
  • Loading branch information
lablup-octodog and fregataa authored Oct 24, 2024
1 parent 7f56816 commit 53bd292
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions changes/2962.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Handle `IndexError` when parse string to `BinarySize`
2 changes: 1 addition & 1 deletion src/ai/backend/common/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ def _parse_str(cls, expr: str) -> Union[BinarySize, Decimal]:
# has no suffix and is not an integer
# -> fractional bytes (e.g., 1.5 byte)
raise ValueError("Fractional bytes are not allowed")
except ArithmeticError:
except (ArithmeticError, IndexError):
raise ValueError("Unconvertible value", orig_expr, ending)
try:
multiplier = cls.suffix_map[suffix]
Expand Down

0 comments on commit 53bd292

Please sign in to comment.