Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1571a1e

Browse files
committed
Since Thomas Wouters kept complaining that he wants access to the the
Unix From lines, change the UnixMailbox class so that _search_start() positions the file *before* the Unix From line instead of after it; change _search_end() to skip one line before looking for the next From line. The rfc822.Message class automatically recognizes these Unix From lines and squirrels them away in the 'unixfrom' instance variable.
1 parent aebf706 commit 1571a1e

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

Lib/mailbox.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,16 @@ class UnixMailbox(_Mailbox):
9797

9898
def _search_start(self):
9999
while 1:
100+
pos = self.fp.tell()
100101
line = self.fp.readline()
101102
if not line:
102103
raise EOFError
103104
if line[:5] == 'From ' and self._isrealfromline(line):
105+
self.fp.seek(pos)
104106
return
105107

106108
def _search_end(self):
109+
self.fp.readline() # Throw away header line
107110
while 1:
108111
pos = self.fp.tell()
109112
line = self.fp.readline()

0 commit comments

Comments
 (0)