Skip to content

Commit

Permalink
[latebinding] wrap structured types because members may be mutable
Browse files Browse the repository at this point in the history
  • Loading branch information
apalala committed Nov 17, 2023
1 parent 850266d commit 6ab8d4b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions late/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 6ab8d4b

Please sign in to comment.