mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
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.
This commit is contained in:
parent
1f47d11ff2
commit
93a696f491
1 changed files with 3 additions and 3 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue