From: Guido van Rossum Date: Thu, 13 Sep 2001 01:29:13 +0000 (+0000) Subject: SF bug #461073: mailbox __iter__ bug, by Andrew Dalke. X-Git-Tag: v2.2.1c1~1821 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=93a696f49171c0593b23817bbf56ab44269a9587;p=thirdparty%2FPython%2Fcpython.git 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. --- diff --git a/Lib/mailbox.py b/Lib/mailbox.py index 98e61f2e07d9..b1c082dd5312 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: