summaryrefslogtreecommitdiffstats
path: root/Lib/mailbox.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2001-09-13 01:29:13 (GMT)
committerGuido van Rossum <guido@python.org>2001-09-13 01:29:13 (GMT)
commit93a696f49171c0593b23817bbf56ab44269a9587 (patch)
tree2805547859c04a93fe444492a7e3ab256c2b112f /Lib/mailbox.py
parent1f47d11ff24bf1796a9a81ee6dcd07705acc407d (diff)
downloadcpython-93a696f49171c0593b23817bbf56ab44269a9587.zip
cpython-93a696f49171c0593b23817bbf56ab44269a9587.tar.gz
cpython-93a696f49171c0593b23817bbf56ab44269a9587.tar.bz2
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.
Diffstat (limited to 'Lib/mailbox.py')
-rwxr-xr-xLib/mailbox.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/mailbox.py b/Lib/mailbox.py
index 98e61f2..b1c082d 100755
--- a/Lib/mailbox.py
+++ b/Lib/mailbox.py
@@ -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: