René's URL Explorer Experiment


Title: Return non-finite floats unchanged from naturaldelta by eeshsaxena · Pull Request #343 · python-humanize/humanize · GitHub

Open Graph Title: Return non-finite floats unchanged from naturaldelta by eeshsaxena · Pull Request #343 · python-humanize/humanize

X Title: Return non-finite floats unchanged from naturaldelta by eeshsaxena · Pull Request #343 · python-humanize/humanize

Description: Summary Fixes #333. naturaldelta() documents that a value which cannot be converted to a number is "returned unchanged." float("nan") is handled (its int() raises ValueError, which is caught), but float("inf")/float("-inf") raise an uncaught OverflowError from int(value), because the except (ValueError, TypeError) clause omitted OverflowError. The behavior was asymmetric and contradicted the docstring. Before >>> humanize.naturaldelta(float("nan")) 'nan' >>> humanize.naturaldelta(float("inf")) OverflowError: cannot convert float infinity to integer After >>> humanize.naturaldelta(float("inf")) 'inf' >>> humanize.naturaldelta(float("-inf")) '-inf' Implementation note The catch is scoped to the int(value) guard only. A finite value too large to convert to a datetime.timedelta (e.g. 1e40) still raises OverflowError from timedelta(), as documented under Raises: - this is verified by an added test so the non-finite guard does not swallow the legitimate overflow. Tests Added test_naturaldelta_nonfinite (nan, inf, -inf returned unchanged) and test_naturaldelta_overflow (finite 1e40 still raises OverflowError). Full tests/test_time.py passes (387 passed).

Open Graph Description: Summary Fixes #333. naturaldelta() documents that a value which cannot be converted to a number is "returned unchanged." float("nan") is handled (its int() raises ValueError, wh...

X Description: Summary Fixes #333. naturaldelta() documents that a value which cannot be converted to a number is "returned unchanged." float("nan") is handled (its int() raise...

Opengraph URL: https://github.com/python-humanize/humanize/pull/343

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:a3fee8d9-157a-601c-16cf-45ec8ee3f142
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idDFDE:2D56BD:8DFCA:C2EB1:6A55328A
html-safe-noncef145d6af856f8580270b2134d9d2bb2b40368982523aab2087730fc7399de962
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERkRFOjJENTZCRDo4REZDQTpDMkVCMTo2QTU1MzI4QSIsInZpc2l0b3JfaWQiOiI0NDY4MjYyNDU4MTg0OTU2MjYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac6df6c6fd022909f3a10248e3b8ff5f7090bebe4140e0e43cb5011a7854906d20
hovercard-subject-tagpull_request:3990124089
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/python-humanize/humanize/pull/343/files
twitter:imagehttps://avatars.githubusercontent.com/u/139802361?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/139802361?s=400&v=4
og:image:altSummary Fixes #333. naturaldelta() documents that a value which cannot be converted to a number is "returned unchanged." float("nan") is handled (its int() raises ValueError, wh...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonefbd8fce4d63ac394c5405faa20aa50d5c9e56b979ac43ee1b26f8e7c47c4cd89
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/python-humanize/humanize git https://github.com/python-humanize/humanize.git
octolytics-dimension-user_id62149795
octolytics-dimension-user_loginpython-humanize
octolytics-dimension-repository_id466683324
octolytics-dimension-repository_nwopython-humanize/humanize
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id466683324
octolytics-dimension-repository_network_root_nwopython-humanize/humanize
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasecf96660b44878f418b09d3d6ecde00ad62332910
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python-humanize/humanize/pull/343/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-humanize%2Fhumanize%2Fpull%2F343%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-humanize%2Fhumanize%2Fpull%2F343%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=python-humanize%2Fhumanize
Reloadhttps://github.com/python-humanize/humanize/pull/343/files
Reloadhttps://github.com/python-humanize/humanize/pull/343/files
Reloadhttps://github.com/python-humanize/humanize/pull/343/files
Please reload this pagehttps://github.com/python-humanize/humanize/pull/343/files
python-humanize https://github.com/python-humanize
humanizehttps://github.com/python-humanize/humanize
Please reload this pagehttps://github.com/python-humanize/humanize/pull/343/files
Notifications https://github.com/login?return_to=%2Fpython-humanize%2Fhumanize
Fork 115 https://github.com/login?return_to=%2Fpython-humanize%2Fhumanize
Star 736 https://github.com/login?return_to=%2Fpython-humanize%2Fhumanize
Code https://github.com/python-humanize/humanize
Issues 12 https://github.com/python-humanize/humanize/issues
Pull requests 12 https://github.com/python-humanize/humanize/pulls
Actions https://github.com/python-humanize/humanize/actions
Security and quality 0 https://github.com/python-humanize/humanize/security
Insights https://github.com/python-humanize/humanize/pulse
Code https://github.com/python-humanize/humanize
Issues https://github.com/python-humanize/humanize/issues
Pull requests https://github.com/python-humanize/humanize/pulls
Actions https://github.com/python-humanize/humanize/actions
Security and quality https://github.com/python-humanize/humanize/security
Insights https://github.com/python-humanize/humanize/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fpython-humanize%2Fhumanize%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fpython-humanize%2Fhumanize%2Fissues%2Fnew%2Fchoose
eeshsaxenahttps://github.com/eeshsaxena
python-humanize:mainhttps://github.com/python-humanize/humanize/tree/main
eeshsaxena:fix-naturaldelta-infhttps://github.com/eeshsaxena/humanize/tree/fix-naturaldelta-inf
Conversation 2 https://github.com/python-humanize/humanize/pull/343
Commits 1 https://github.com/python-humanize/humanize/pull/343/commits
Checks 0 https://github.com/python-humanize/humanize/pull/343/checks
Files changed 2 https://github.com/python-humanize/humanize/pull/343/files
Return non-finite floats unchanged from naturaldelta https://github.com/python-humanize/humanize/pull/343/files#top
Show all changes 1 commit https://github.com/python-humanize/humanize/pull/343/files
95c4470 Return non-finite floats unchanged from naturaldelta eeshsaxena Jul 4, 2026 https://github.com/python-humanize/humanize/pull/343/commits/95c447063e88c4bebada3f530b44714bb5f9f121
Clear filters https://github.com/python-humanize/humanize/pull/343/files
Please reload this pagehttps://github.com/python-humanize/humanize/pull/343/files
Please reload this pagehttps://github.com/python-humanize/humanize/pull/343/files
time.py https://github.com/python-humanize/humanize/pull/343/files#diff-b3fe03965d3c376310ca8f826ead2c13caa55b4db21219b97eb1a50c9395be28
test_time.py https://github.com/python-humanize/humanize/pull/343/files#diff-979a615160c52325109169404ba4adcb39b6deecd3806a0171f0632be90aede0
src/humanize/time.pyhttps://github.com/python-humanize/humanize/pull/343/files#diff-b3fe03965d3c376310ca8f826ead2c13caa55b4db21219b97eb1a50c9395be28
View file https://github.com/eeshsaxena/humanize/blob/95c447063e88c4bebada3f530b44714bb5f9f121/src/humanize/time.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python-humanize/humanize/pull/343/{{ revealButtonHref }}
https://github.com/python-humanize/humanize/pull/343/files#diff-b3fe03965d3c376310ca8f826ead2c13caa55b4db21219b97eb1a50c9395be28
https://github.com/python-humanize/humanize/pull/343/files#diff-b3fe03965d3c376310ca8f826ead2c13caa55b4db21219b97eb1a50c9395be28
tests/test_time.pyhttps://github.com/python-humanize/humanize/pull/343/files#diff-979a615160c52325109169404ba4adcb39b6deecd3806a0171f0632be90aede0
View file https://github.com/eeshsaxena/humanize/blob/95c447063e88c4bebada3f530b44714bb5f9f121/tests/test_time.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python-humanize/humanize/pull/343/{{ revealButtonHref }}
https://github.com/python-humanize/humanize/pull/343/files#diff-979a615160c52325109169404ba4adcb39b6deecd3806a0171f0632be90aede0
https://github.com/python-humanize/humanize/pull/343/files#diff-979a615160c52325109169404ba4adcb39b6deecd3806a0171f0632be90aede0
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.