From 93a696f49171c0593b23817bbf56ab44269a9587 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Thu, 13 Sep 2001 01:29:13 +0000 Subject: 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. --- Lib/mailbox.py | 6 +++--- 1 file 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: -- cgit v0.12