René's URL Explorer Experiment


Title: Interval.range() hangs forever on a zero (or wrong-sign) step · Issue #1080 · python-pendulum/pendulum · GitHub

Open Graph Title: Interval.range() hangs forever on a zero (or wrong-sign) step · Issue #1080 · python-pendulum/pendulum

X Title: Interval.range() hangs forever on a zero (or wrong-sign) step · Issue #1080 · python-pendulum/pendulum

Description: Affected version: confirmed on release v3.3.0, commit e06dacedc4cdea90fa1286b3965d180ab94cf251. Summary Interval.range(unit, amount) accepts any integer amount, including 0, without validation. Because the loop's advance step and its ter...

Open Graph Description: Affected version: confirmed on release v3.3.0, commit e06dacedc4cdea90fa1286b3965d180ab94cf251. Summary Interval.range(unit, amount) accepts any integer amount, including 0, without validation. Bec...

X Description: Affected version: confirmed on release v3.3.0, commit e06dacedc4cdea90fa1286b3965d180ab94cf251. Summary Interval.range(unit, amount) accepts any integer amount, including 0, without validation. Bec...

Opengraph URL: https://github.com/python-pendulum/pendulum/issues/1080

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.4


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Interval.range() hangs forever on a zero (or wrong-sign) step","articleBody":"Affected version: confirmed on release `v3.3.0`, commit `e06dacedc4cdea90fa1286b3965d180ab94cf251`.\n\n## Summary\n\n`Interval.range(unit, amount)` accepts any integer `amount`, including `0`, without validation. Because the loop's advance step and its termination check both depend on `amount`, an `amount` of `0` produces a generator that yields the same starting value forever and never reaches its stated end. Any caller that consumes the generator without an independent bound (a plain `for` loop, `list(...)`, or similar) hangs indefinitely, consuming CPU with no progress, until something external kills the process.\n\n## Details\n\n`src/pendulum/interval.py`:\n\n```python\ndef range(self, unit: str, amount: int = 1) -> Iterator[_T]:\n    method = \"add\"\n    op = operator.le\n    if not self._absolute and self.invert:\n        method = \"subtract\"\n        op = operator.ge\n\n    start, end = self.start, self.end\n\n    i = amount\n    while op(start, end):\n        yield start\n\n        start = getattr(self.start, method)(**{unit: i})\n\n        i += amount\n```\n\nWhen `amount == 0`:\n- `i` starts at `0` and `i += amount` keeps it at `0` on every iteration.\n- `start = self.start.add(**{unit: i})` recomputes the same value as `self.start` every time, since the added quantity is always `0`.\n- The loop condition `op(start, end)` (effectively `start \u003c= end`) stays true forever, because `start` never advances past `end`.\n\nThe function is a public method on `Interval`/`Period` objects (`pendulum.interval(start, end).range(unit, amount)`), documented as part of the library's date-range iteration API, with no stated restriction that `amount` must be non-zero.\n\n## Steps To Reproduce\n\n(available upon request)\n\n## Impact\n\nA caller that builds a date range from a step value it does not fully control (a configuration field, a query parameter, a value derived from user input) and passes it to `Interval.range()` can be made to hang indefinitely on `amount=0`, consuming a full CPU core with no progress and no way to recover short of killing the worker from outside. This is a realistic pattern: date-range \"step\"/\"interval\" parameters are commonly user- or config-driven (reporting tools, scheduling/trading-strategy libraries that iterate a period at a configurable interval, etc). A related but distinct case, a wrong-sign `amount` on an interval whose direction it does not match (e.g. `amount=-1` on a forward interval), does not hang but instead runs away unbounded in the opposite direction from the stated end, the same missing-validation root cause producing unbounded resource consumption rather than a hang.\n\nSuggested fix: reject `amount == 0` with a `ValueError`, and either require the sign of `amount` to match the interval's direction or normalize it automatically, with regression tests covering both the zero-step and wrong-sign-step cases.\n","author":{"url":"https://github.com/carfeii","@type":"Person","name":"carfeii"},"datePublished":"2026-11-02T14:35:53Z","url":"https://github.com/python-pendulum/pendulum/issues/1080"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:778e4b75-71a8-ef09-abc1-256df166d987
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA34E:3D1C6E:10D667:17C9FB:6B0464BE
html-safe-nonce7edcc9118e5940071b0ad29fae730833b162ca7a4367ed959fe558190012bf92
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMzRFOjNEMUM2RToxMEQ2Njc6MTdDOUZCOjZCMDQ2NEJFIiwidmlzaXRvcl9pZCI6IjQ1NDA5MDM5NzAzMjE0NjExMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac22b3ca21a3c9a00f58a2ec69963ef294733b12d8afb20032f024ad89bf33824b
hovercard-subject-tagissue:6164640430
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-pendulum/pendulum/1080/issue_layout
twitter:imagehttps://opengraph.githubassets.com/9c60c4fe1ecf9b0d32156c2be9516f08596715f03ddf611cbb707b41d61a3f57/python-pendulum/pendulum/issues/1080
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/9c60c4fe1ecf9b0d32156c2be9516f08596715f03ddf611cbb707b41d61a3f57/python-pendulum/pendulum/issues/1080
og:image:altAffected version: confirmed on release v3.3.0, commit e06dacedc4cdea90fa1286b3965d180ab94cf251. Summary Interval.range(unit, amount) accepts any integer amount, including 0, without validation. Bec...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamecarfeii
hostnamegithub.com
expected-hostnamegithub.com
None2d58451b4bcb73c33c67bfb6b28fb75fe6d5e279daf9b560fa4fd832f3d8c9a6
turbo-cache-controlno-preview
go-importgithub.com/python-pendulum/pendulum git https://github.com/python-pendulum/pendulum.git
octolytics-dimension-user_id191041900
octolytics-dimension-user_loginpython-pendulum
octolytics-dimension-repository_id62095504
octolytics-dimension-repository_nwopython-pendulum/pendulum
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id62095504
octolytics-dimension-repository_network_root_nwopython-pendulum/pendulum
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release03e114520787ad27289207f153520ef97461127c
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python-pendulum/pendulum/issues/1080#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-pendulum%2Fpendulum%2Fissues%2F1080
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
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
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://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
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-pendulum%2Fpendulum%2Fissues%2F1080
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python-pendulum%2Fpendulum
Reloadhttps://github.com/python-pendulum/pendulum/issues/1080
Reloadhttps://github.com/python-pendulum/pendulum/issues/1080
Reloadhttps://github.com/python-pendulum/pendulum/issues/1080
python-pendulumhttps://github.com/python-pendulum
pendulumhttps://github.com/python-pendulum/pendulum
Codehttps://github.com/python-pendulum/pendulum
Issues211 (211)https://github.com/python-pendulum/pendulum/issues
Pull requests96 (96)https://github.com/python-pendulum/pendulum/pulls
Discussionshttps://github.com/python-pendulum/pendulum/discussions
Actionshttps://github.com/python-pendulum/pendulum/actions
Projectshttps://github.com/python-pendulum/pendulum/projects
Security and qualityhttps://github.com/python-pendulum/pendulum/security
Insightshttps://github.com/python-pendulum/pendulum/insights
https://github.com/python-pendulum/pendulum
New issuehttps://github.com/login?return_to=https://github.com/python-pendulum/pendulum/issues/1080
New issuehttps://github.com/login?return_to=https://github.com/python-pendulum/pendulum/issues/1080
#1081https://github.com/python-pendulum/pendulum/pull/1081
Interval.range() hangs forever on a zero (or wrong-sign) stephttps://github.com/python-pendulum/pendulum/issues/1080#top
#1081https://github.com/python-pendulum/pendulum/pull/1081
https://github.com/carfeii
carfeiihttps://github.com/carfeii
on Nov 2, 2026https://github.com/python-pendulum/pendulum/issues/1080#issue-6164640430
Sign up for freehttps://github.com/signup?return_to=https://github.com/python-pendulum/pendulum/issues/1080
Sign in to commenthttps://github.com/login?return_to=https://github.com/python-pendulum/pendulum/issues/1080
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

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.