• Kevin Modzelewski's avatar
    Support StopIteration-based for loop iteration · a14ebbec
    Kevin Modzelewski authored
    At runtime, we can detect if something supports the new Pyston iteration
    protocol (__hasnext__) or not.
    
    Statically, when we lower a for loop, we assume that the iterator supports
    the new protocol, and we can't check it
    
    This commit adds a check to getiter() which wraps a Python-style iterator
    with an IterWrapper which adds the __hasnext__ method.
    a14ebbec
iterobject.h 1.42 KB