Repository navigation
Conversation
Wkhanex
left a comment
There was a problem hiding this comment.
I checked 31 standalone cases across signed durations and numeric seconds, including 4,000,000 and 999,999,999 days, timedelta.min/max, invalid-input fallbacks and fractional seconds retained beside a large day count. All passed. The result for timedelta.max at minimum_unit='days' was 1000000000 days, reflecting rounding rather than a calendar-date overflow.
I also checked minimum_unit='seconds' with years/months/hours/minutes suppressed: both one day and 999,999,999 days retained the additional 0.50 seconds. For this source checkout I supplied only the build-generated version metadata module as a stub; the time formatter itself was unchanged.
I used Python 3.12.14 against commit cb8ced7. These were focused checks, not a full-suite run.
precisedelta(timedelta(days=4_000_000))currently raisesOverflowError: date value out of range. The duration itself is valid; the failure comes from constructing a calendar date that this formatter never uses. The same limit affects numeric seconds andtimedelta.min/timedelta.max.Operate directly on absolute timedeltas for duration inputs, retaining the existing relative-date path for datetime inputs. Annotate the unit accumulators as float because unit suppression and minimum-unit rounding can produce fractional counts.
Six regressions cover signed4-million-day timedeltas, the corresponding numeric seconds, and the timedelta bounds. All six fail before the fix. Afterward,735 behavior/doctest cases pass with112 translation-related skips, strict
mypy .passes, all repository prek hooks pass, andgit diff --checkpasses. Performance benchmarks were excluded from this behavior run.Prepared with AI assistance.