Skip to content

[python-dateutil] tzrange.transitions() can return None - #16870

Open
ArthDubey1011 wants to merge 1 commit into
python:mainfrom
ArthDubey1011:none-dateutil
Open

ArthDubey1011 wants to merge 1 commit into
python:mainfrom
ArthDubey1011:none-dateutil

Conversation

@ArthDubey1011

@ArthDubey1011 ArthDubey1011 commented Nov 19, 2026 •

Copy link
Copy Markdown

tzrange.transitions() returns None for zones without DST, as its docstring says ("or None for fixed offset zones"). See the source:

def transitions(self, year):

    ...

    if not self.hasdst:

        return None

The tzwinbase.transitions() stub already returns tuple[datetime, datetime] | None for the same reason. Checked with python-dateutil 2.9.0.post0:

>>> from dateutil import tz

>>> print(tz.tzrange("EST", -18000).transitions(2024))

None

tzstr inherits this method, so it gets the fix as well.

AI assistance: Claude Code (Claude Opus 5.5) found this by comparing the stubs with the runtime source, ran the check above and made the edit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

This branch has not been deployed

No deployments
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