Skip to content

fix: raise ValueError for out-of-range duration strings - #1504

Merged
Delgan merged 2 commits into
Delgan:masterfrom
BetterAndBetterII:fix/duration-overflow
Aug 29, 2026
Merged

Delgan merged 2 commits into
Delgan:masterfrom
BetterAndBetterII:fix/duration-overflow

Conversation

@BetterAndBetterII

Copy link
Copy Markdown
Contributor

Summary

  • parse_duration() accepted scientific-notation duration strings that overflow datetime.timedelta and leaked OverflowError through logger.add() for rotation / retention.
  • Catch that overflow and raise ValueError with the same style as the other duration parse errors.
  • In-range values such as 1e6s are unchanged.

Fixes #1502

Test plan

  • RED then GREEN: 1e14s / 1e20s / 1e309s for both rotation and retention raise ValueError
  • tests/test_filesink_rotation.py + tests/test_filesink_retention.py (198 passed, 3 skipped)

BetterAndBetterII and others added 2 commits August 28, 2026 12:46
parse_duration() accepted scientific-notation values that overflow
datetime.timedelta and leaked OverflowError through logger.add().
Catch that and report a ValueError consistent with other duration
parse failures.

Fixes Delgan#1502
@Delgan
Delgan merged commit d3c5905 into Delgan:master Aug 29, 2026
21 checks passed
@Delgan

Delgan commented Aug 29, 2026

Copy link
Copy Markdown
Owner

That's good, thanks. Please disclose AI usage next time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Out-of-range duration strings for rotation / retention leak OverflowError from datetime.timedelta

2 participants