Repository navigation
fix: return stable error detail for out-of-range datetimes in str_to_interval - #991
Merged
vincentsarago merged 3 commits intoOct 9, 2026
Merged
Conversation
…interval iso8601.ParseError forwards the Python-version-dependent datetime error message. Raise a fixed ValueError instead so the 400 detail is the same on every Python version.
mohanedmoh
force-pushed
the
fix-str-to-interval-error-detail
branch
from
October 7, 2026 08:18
0dc3927 to
be7ebec
Compare
jonhealy1
approved these changes
Oct 9, 2026
jonhealy1
left a comment
Collaborator
There was a problem hiding this comment.
@mohanedmoh Thank you
vincentsarago
approved these changes
Oct 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issue(s):
Description:
str_to_intervalreturnedstr(e)as the 400 detail for out-of-range datetimes. That text comes fromiso8601.ParseError, which wraps CPython's owndatetimeerror, so it differs between Python versions (e.g.month must be in 1..12on 3.13 vsmonth must be in 1..12, not 13on 3.14).rfc3339_str_to_datetimenow convertsiso8601.ParseErrorintoValueError("Invalid RFC3339 datetime."), as its docstring already states. The other fixed messages instr_to_intervalare unchanged. Added one parametrized test asserting the exact detail.PR Checklist:
pre-commithooks pass locallymake test)make docs)