Issue 818065: mailbox._Subfile readline() bug (original) (raw)

Issue818065

Created on 2003-10-05 11:09 by jbperez808, last changed 2022-04-10 16:11 by admin. This issue is now closed.

Messages (3)
msg18565 - (view) Author: Jonathan Perez (jbperez808) Date: 2003-10-05 11:09
mailbox._Subfile's readline() will chop off the first character of the next line when reading Unix-style terminated files. It's surprising no one has mentioned this before. The problem lies in line mailbox._Subfile.readline() itself where self.pos is assigned self.fp.tell()'s value. You will need to subtract 1 from self.pos if a file uses unix-style termination.
msg18566 - (view) Author: Jonathan Perez (jbperez808) Date: 2003-10-06 13:33
Logged In: YES user_id=286435 There doesn't seem to be a clean way to fix the code. But there is a rather satisfactory workaround: Open the mbox file in binary mode for Unix (and Mac?) style terminated files. This should DEFINITELY be mentioned in the mailbox module docs.
msg60165 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2008-01-19 14:14
I guess this bug report is out of date: mailbox.py doesn't seem to contain a _Subfile class, the ProxyFile.readline() function is one line, and there's no self.pos variable either. Probably 2.5's rewrite of the module removed this code.
History
Date User Action Args
2022-04-10 16:11:38 admin set github: 39374
2008-01-19 14:14:52 akuchling set status: open -> closedresolution: not a bugmessages: +
2003-10-05 11:09:24 jbperez808 create