summaryrefslogtreecommitdiff
path: root/Lib/mailbox.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2001-09-13 01:29:13 +0000
committerGuido van Rossum <guido@python.org>2001-09-13 01:29:13 +0000
commit65949dce5bdaed2cc323c26010d0e247bdbf99e2 (patch)
tree475b63c6ef9cba6e1761a670df05a3c67b8b96e5 /Lib/mailbox.py
parent2d73e173cb69891d51151fcd18f05d189d519e6d (diff)
downloadcpython-65949dce5bdaed2cc323c26010d0e247bdbf99e2.tar.gz
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 98e61f2e07..b1c082dd53 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: