SF bug #461073: mailbox __iter__ bug, by Andrew Dalke.

Andrew quite correctly notices that the next() method isn't quite what
we need, since it returns None upon end instead of raising
StopIteration.  His fix is easy enough, using iter(self.next, None)
instead.
This commit is contained in:
Guido van Rossum 2001-09-13 01:29:13 +00:00
parent 1f47d11ff2
commit 93a696f491
1 changed files with 3 additions and 3 deletions

View File

@ -15,7 +15,7 @@ class _Mailbox:
self.factory = factory
def __iter__(self):
return self
return iter(self.next, None)
def next(self):
while 1:
@ -195,7 +195,7 @@ class MHMailbox:
self.factory = factory
def __iter__(self):
return self
return iter(self.next, None)
def next(self):
if not self.boxes:
@ -226,7 +226,7 @@ class Maildir:
self.boxes = boxes
def __iter__(self):
return self
return iter(self.next, None)
def next(self):
if not self.boxes: