Open
Description
After only checking that the parameter is Iterable
, newbytes
then checks the parameters len()
.
python-future/src/future/types/newbytes.py
Line 106 in 39a066e
print(repr(bytes.newbytes(x for x in range(0))))
Traceback (most recent call last):
File "main.py", line 4, in <module>
print(repr(bytes.newbytes(x for x in range(0))))
File "/home/runner/bytes.py", line 103, in __new__
if len(args[0]) == 0:
TypeError: object of type 'generator' has no len()
Including a check for Sized
as well avoids this.
if isinstance(args[0], Sized) and len(args[0]) == 0: