Skip to content

Fix arrow.get() crashing when tzinfo=None is explicitly passed - #1351

Open
aoright wants to merge 2 commits into
arrow-py:masterfrom
aoright:fix-tzinfo-none
Open

aoright wants to merge 2 commits into
arrow-py:masterfrom
aoright:fix-tzinfo-none

Conversation

@aoright

@aoright aoright commented Sep 11, 2026

Copy link
Copy Markdown

Fixes #1259

When arrow.get() is invoked with tzinfo=None, the tzinfo kwarg is placed in kwargs with a value of None. In factory.py, the condition if len(kwargs) == 1 and tz is None: assumes that if tz is None it means the user omitted tzinfo. However, if the user explicitly provided tzinfo=None, this triggers the condition to true and redirects the call to the Arrow constructor which throws TypeError.

This PR fixes the check to if len(kwargs) == 1 and "tzinfo" not in kwargs:, properly distinguishing between an omitted tzinfo kwarg and an explicit tzinfo=None kwarg.

Tests have been added.

@codecov

codecov Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (2224255) to head (e6a8878).

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #1351   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           10        10           
  Lines         2315      2315           
  Branches       358       358           
=========================================
  Hits          2315      2315           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

Signed-off-by: Aoright <aoright@example.com>

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.

arrow.get() behaviour for tzinfo=None

1 participant