Skip to content

Reject non-positive date_range steps#1339

Open
CodingFeng101 wants to merge 1 commit into
scrapinghub:masterfrom
CodingFeng101:codex/reject-nonpositive-date-range-step
Open

Reject non-positive date_range steps#1339
CodingFeng101 wants to merge 1 commit into
scrapinghub:masterfrom
CodingFeng101:codex/reject-nonpositive-date-range-step

Conversation

@CodingFeng101

Copy link
Copy Markdown

Summary

Reject date_range() steps that do not advance the generated date. Passing values such as months=0 or days=-1 currently allows the generator to yield the start date and then continue without making forward progress, which can hang callers that consume the full iterator with list(...).

Changes

  • Add a positive-step validation in dateparser.date.date_range().
  • Add a focused regression test for zero-month and negative-day steps.

Validation

  • python -m pytest tests/test_date_range.py -q -> 2 passed
  • Manual smoke check confirmed normal daily and monthly ranges still produce the same forward dates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant