def FOR_ITER(self, target): w_iterator = self.peekvalue() try: w_nextitem = op.next(w_iterator).eval(self) self.pushvalue(w_nextitem) except Raise as e: if self.exception_match(e.w_exc.w_type, const(StopIteration)): self.popvalue() return target else: raise
def FOR_ITER(self, target): w_iterator = self.peekvalue() self.blockstack.append(IterBlock(self, target)) w_nextitem = op.next(w_iterator).eval(self) self.blockstack.pop() self.pushvalue(w_nextitem)