From 6ab8d4b2101e878e08ea7027ff626d7430925acc Mon Sep 17 00:00:00 2001 From: apalala Date: Thu, 16 Nov 2023 20:12:41 -0400 Subject: [PATCH] [latebinding] wrap structured types because members may be mutable --- late/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/late/__init__.py b/late/__init__.py index 218bdd4..08863ea 100644 --- a/late/__init__.py +++ b/late/__init__.py @@ -17,7 +17,7 @@ class _LateBound(NamedTuple): def late(o: _T | Iterator[_V] | Callable[[], _R]) -> _T | _V | _R: - if o is None or isinstance(o, int | float | bool | str | bytes | tuple | frozenset): + if isinstance(o, int | float | bool | str | bytes): return o # type: ignore return _LateBound(actual=o) # type: ignore @@ -30,7 +30,7 @@ def late(o: _T | Iterator[_V] | Callable[[], _R]) -> _T | _V | _R: def _resolve_value(value): if isinstance(value, _LateBound): value = value.actual - if isinstance(value, int | float | str | bytes | bool | tuple | bytearray | frozenset): + if isinstance(value, int | float | bool | str | bytes): return value if isinstance(value, Iterator): return next(value)