Skip to content

fix(factory): handle explicit tzinfo=None in arrow.get()#1273

Open
armorbreak001 wants to merge 1 commit intoarrow-py:masterfrom
armorbreak001:fix/1259-tzinfo-none-get
Open

fix(factory): handle explicit tzinfo=None in arrow.get()#1273
armorbreak001 wants to merge 1 commit intoarrow-py:masterfrom
armorbreak001:fix/1259-tzinfo-none-get

Conversation

@armorbreak001
Copy link
Copy Markdown

Summary

Fixes #1259.

When tzinfo=None is explicitly passed to arrow.get() (e.g. from a variable that may be None), it was incorrectly treated as 'tzinfo not provided'. This caused the factory to route to the 3-argument constructor path, which fails for calls like arrow.get('2025-01-01', 'YYYY-MM-DD', tzinfo=None) with:

TypeError: Arrow.__init__() missing 1 required positional argument: 'day'

Changes

Use a sentinel object to distinguish between tzinfo being omitted vs explicitly set to None. When explicitly None, the factory now correctly proceeds through the normal (str, format) parsing path instead of being misrouted to the constructor path.

When tzinfo=None is explicitly passed to arrow.get(), it was
incorrectly treated as 'not provided', causing the factory to
route to the 3-arg constructor path which fails for (str, fmt)
calls. Use a sentinel to distinguish missing from explicit None.
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.

arrow.get() behaviour for tzinfo=None

1 participant