ironpython3 icon indicating copy to clipboard operation
ironpython3 copied to clipboard

iter not called on subclasses of bytes

Open slozier opened this issue 2 years ago • 1 comments

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.

slozier avatar Jul 30 '22 02:07 slozier

I guess it's not exclusive to pyserial. Unable to pip install anything tonight...

slozier avatar Jul 30 '22 02:07 slozier