Commit 93a696f4 authored by Guido van Rossum's avatar Guido van Rossum

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.
parent 1f47d11f
...@@ -15,7 +15,7 @@ class _Mailbox: ...@@ -15,7 +15,7 @@ class _Mailbox:
self.factory = factory self.factory = factory
def __iter__(self): def __iter__(self):
return self return iter(self.next, None)
def next(self): def next(self):
while 1: while 1:
...@@ -195,7 +195,7 @@ class MHMailbox: ...@@ -195,7 +195,7 @@ class MHMailbox:
self.factory = factory self.factory = factory
def __iter__(self): def __iter__(self):
return self return iter(self.next, None)
def next(self): def next(self):
if not self.boxes: if not self.boxes:
...@@ -226,7 +226,7 @@ class Maildir: ...@@ -226,7 +226,7 @@ class Maildir:
self.boxes = boxes self.boxes = boxes
def __iter__(self): def __iter__(self):
return self return iter(self.next, None)
def next(self): def next(self):
if not self.boxes: if not self.boxes:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment