Skip to content

Commit cf087d2

Browse files
committed
also exclude bytes in is_iterable_but_str
1 parent 38f9ee5 commit cf087d2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,7 @@ def __len__(self):
970970

971971

972972
def is_iterable_but_str(obj: object) -> TypeGuard[typing.Iterable[typing.Any]]:
973-
""" but not a `str` (because technically, `str` is `Iterable[str]`) """
974-
if isinstance(obj, str):
973+
""" but not a `str` nor `bytes` (because technically, `str` and `bytes` are `Iterable[str | bytes]`) """
974+
if isinstance(obj, (str, bytes)):
975975
return False
976976
return isinstance(obj, typing.Iterable)

0 commit comments

Comments
 (0)