Skip to content

Fix OverflowError in naturaltime/precisedelta for far-future dates - #479

Merged
hugovk merged 4 commits into
python-humanize:mainfrom
tamsk-91:main
Nov 12, 2026
Merged

hugovk merged 4 commits into
python-humanize:mainfrom
tamsk-91:main

Conversation

@tamsk-91

Copy link
Copy Markdown
Contributor

Fixes an OverflowError in naturaltime() and precisedelta() for far-future dates such as datetime(9999, 12, 31) by using abs(delta) in _abs_timedelta(). Adds regression tests.

Muguett-DBY

This comment was marked as low quality.

@hugovk hugovk added the changelog: Fixed For any bug fixes label Nov 12, 2026
@codecov

codecov Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.70%. Comparing base (d16e635) to head (df8ec3f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #479      +/-   ##
==========================================
- Coverage   99.70%   99.70%   -0.01%     
==========================================
  Files          12       12              
  Lines        1024     1021       -3     
==========================================
- Hits         1021     1018       -3     
  Misses          3        3              
Flag Coverage Δ
macos-latest 97.25% <100.00%> (-0.01%) ⬇️
ubuntu-latest 97.25% <100.00%> (-0.01%) ⬇️
windows-latest 91.96% <100.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread src/humanize/time.py Resolved
Comment thread tests/test_time.py Resolved
Comment thread tests/test_time.py Resolved
@hugovk hugovk changed the title Fix OverflowError in naturaltime/precisedelta for far-future dates Fix OverflowError in naturaltime/precisedelta for far-future dates Nov 12, 2026
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
@hugovk
hugovk merged commit 318888d into python-humanize:main Nov 12, 2026
42 of 43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: Fixed For any bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants