Repository navigation
[python-dateutil] relativedelta accepts float durations - #16782
Open
maringuadarrama wants to merge 1 commit into
Open
maringuadarrama wants to merge 1 commit into
maringuadarrama wants to merge 1 commit into
Conversation
relativedelta(days=1.5), weeks=, hours=, minutes=, seconds= and microseconds= are accepted at runtime and normalised by _fix(); only years and months must be integral (ValueError otherwise), so they stay int. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
relativedelta.__init__typesdays,weeks,hours,minutes,secondsandmicrosecondsasint, but dateutil accepts floats for all of them and normalises them in_fix():Only
yearsandmonthsmust be integral (ValueError: Non-integer years and months are ambiguous and not currently supported.), so they stayint, as do the absolute fields (year=,hour=, ...), which go todatetime.replace().leapdaysalso accepts a float at runtime but counts days added in a leap year, so it staysinthere.The attributes stay
intas well. A relativedelta built from float durations holds floats, sofloatwould be the exact type, but widening the attributes would break existing code that readsrd.daysas anint. I can widen them too if you'd prefer the exact types.🤖 Generated with Claude Code