diff --git a/arrow/factory.py b/arrow/factory.py index 0913bfe1..dc31c66d 100644 --- a/arrow/factory.py +++ b/arrow/factory.py @@ -196,7 +196,7 @@ def get(self, *args: Any, **kwargs: Any) -> Arrow: arg_count = 3 # tzinfo kwarg is not provided - if len(kwargs) == 1 and tz is None: + if len(kwargs) == 1 and "tzinfo" not in kwargs: arg_count = 3 # () -> now, @ tzinfo or utc diff --git a/tests/test_factory.py b/tests/test_factory.py index 056cee41..87b952de 100644 --- a/tests/test_factory.py +++ b/tests/test_factory.py @@ -294,6 +294,15 @@ def test_two_args_str_tzinfo(self): result._datetime, datetime(2013, 1, 1, tzinfo=ZoneInfo("US/Pacific")) ) + def test_two_args_str_str_tzinfo_none(self): + # Regression test for issue #1259: explicit tzinfo=None should be + # treated the same as omitting tzinfo entirely. + result = self.factory.get("2025-01-01", "YYYY-MM-DD", tzinfo=None) + expected = self.factory.get("2025-01-01", "YYYY-MM-DD") + + assert result == expected + assert result._datetime == datetime(2025, 1, 1, tzinfo=tz.tzutc()) + def test_two_args_twitter_format(self): # format returned by twitter API for created_at: twitter_date = "Fri Apr 08 21:08:54 +0000 2016"