ironpython3
ironpython3 copied to clipboard
iter not called on subclasses of bytes
For example:
class test(bytes):
def __init__(self):
self.it= False
def __iter__(self):
self.it = True
return self
def __next__(self):
raise StopIteration
# via for loop
t = test()
for x in t: pass
assert t.it
# via list
t = test()
list(t)
assert t.it
This issue also seems to occur for other iterable base classes:
-
str: fails on list call -
tuple: StackOverflowException -
list: StackOverflowException -
collections.deque: fails on for loop and list call -
set: fails on for loop and list call - other cases?
Hit this failure while trying to run ipy -m pip install pyserial.
I guess it's not exclusive to pyserial. Unable to pip install anything tonight...