PEP 479:  Use the return-keyword instead of raising StopIteration inside a generators.
diff --git a/Lib/mailbox.py b/Lib/mailbox.py
index 145b204..e7f31df 100644
--- a/Lib/mailbox.py
+++ b/Lib/mailbox.py
@@ -1949,7 +1949,7 @@
         while True:
             line = self.readline()
             if not line:
-                raise StopIteration
+                return
             yield line
 
     def tell(self):