Issue 880621: incorrect end-of-message handling in mailbox.BabylMailbox (original) (raw)
The mailbox.BabylMailbox class does not handle end of message correctly. The last message in a mailbox ends in '\037' instead of '\037\014\n' (i.e. FF and LF do not exist at the end of the mailbox). However, the class in question does not take this special case into account, so that application programs get '\037' as the last line of the last message. Following is a simple fix of this bug:
--- mailbox.py.orig Tue Jan 20 23:10:32 2004 +++ mailbox.py Tue Jan 20 23:08:17 2004 @@ -263,7 +263,7 @@ line = self.fp.readline() if not line: return
if line == '\037\014\n':
if line == '\037\014\n' or line == '\037': self.fp.seek(pos) return
The bug is in Python 2.3.3 and probably all of older versions.