From 8ef572ba522144e26a290e691276eda93eec9c84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julio=20C=C3=A9sar=20Su=C3=A1stegui?= Date: Fri, 3 Apr 2026 03:27:50 -0600 Subject: [PATCH 1/3] fix(types): use Union[Arrow, dt_datetime] for span_range and interval start/end params Arrow.range() already typed start/end as Union['Arrow', dt_datetime] since both types work via fromdatetime() internally. span_range() and interval() accept the same union but were typed as dt_datetime only, causing mypy/pyright errors when passing Arrow objects directly. Aligns the type signatures of all three class methods for consistency. Fixes #1210. --- arrow/arrow.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arrow/arrow.py b/arrow/arrow.py index f0a57f04..c0a4e25e 100644 --- a/arrow/arrow.py +++ b/arrow/arrow.py @@ -643,8 +643,8 @@ def ceil(self, frame: _T_FRAMES, **kwargs: Any) -> "Arrow": def span_range( cls, frame: _T_FRAMES, - start: dt_datetime, - end: dt_datetime, + start: Union["Arrow", dt_datetime], + end: Union["Arrow", dt_datetime], tz: Optional[TZ_EXPR] = None, limit: Optional[int] = None, bounds: _BOUNDS = "[)", @@ -725,8 +725,8 @@ def span_range( def interval( cls, frame: _T_FRAMES, - start: dt_datetime, - end: dt_datetime, + start: Union["Arrow", dt_datetime], + end: Union["Arrow", dt_datetime], interval: int = 1, tz: Optional[TZ_EXPR] = None, bounds: _BOUNDS = "[)", From 3eb0cca079e534db2f61564a99eb84afed93fe6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julio=20C=C3=A9sar=20Su=C3=A1stegui?= Date: Fri, 3 Apr 2026 03:33:30 -0600 Subject: [PATCH 2/3] fix(types): normalize Arrow inputs via _get_datetime before fromdatetime calls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fromdatetime() only accepts datetime, not Arrow. span_range and interval now call cls._get_datetime(start/end) to convert Arrow objects to their underlying datetime before passing to fromdatetime — matching the pattern already used in Arrow.range(). This satisfies mypy while preserving the Union[Arrow, dt_datetime] type hint on the public API. --- arrow/arrow.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arrow/arrow.py b/arrow/arrow.py index c0a4e25e..0d8ac284 100644 --- a/arrow/arrow.py +++ b/arrow/arrow.py @@ -702,8 +702,8 @@ def span_range( """ tzinfo = cls._get_tzinfo(start.tzinfo if tz is None else tz) - start = cls.fromdatetime(start, tzinfo).span(frame, exact=exact)[0] - end = cls.fromdatetime(end, tzinfo) + start = cls.fromdatetime(cls._get_datetime(start), tzinfo).span(frame, exact=exact)[0] + end = cls.fromdatetime(cls._get_datetime(end), tzinfo) _range = cls.range(frame, start, end, tz, limit) if not exact: for r in _range: From 1e962111bf2e24bf85133a707d212d0f3f5ff151 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julio=20C=C3=A9sar=20Su=C3=A1stegui?= Date: Fri, 3 Apr 2026 03:38:38 -0600 Subject: [PATCH 3/3] =?UTF-8?q?style:=20apply=20black=20formatting=20?= =?UTF-8?q?=E2=80=94=20break=20long=20line=20in=20span=5Frange?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- arrow/arrow.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arrow/arrow.py b/arrow/arrow.py index 0d8ac284..6ca7b067 100644 --- a/arrow/arrow.py +++ b/arrow/arrow.py @@ -702,7 +702,9 @@ def span_range( """ tzinfo = cls._get_tzinfo(start.tzinfo if tz is None else tz) - start = cls.fromdatetime(cls._get_datetime(start), tzinfo).span(frame, exact=exact)[0] + start = cls.fromdatetime(cls._get_datetime(start), tzinfo).span( + frame, exact=exact + )[0] end = cls.fromdatetime(cls._get_datetime(end), tzinfo) _range = cls.range(frame, start, end, tz, limit) if not exact: