[ python-Bugs-818065 ] mailbox._Subfile readline() bug

SourceForge.net noreply at sourceforge.net
Sun Jul 15 02:05:24 CEST 2007


Bugs item #818065, was opened at 2003-10-05 07:09
Message generated for change (Settings changed) made by akuchling
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=818065&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Jonathan Perez (jbperez808)
>Assigned to: A.M. Kuchling (akuchling)
Summary: mailbox._Subfile readline() bug

Initial Comment:
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.

----------------------------------------------------------------------

Comment By: Jonathan Perez (jbperez808)
Date: 2003-10-06 09:33

Message:
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.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=818065&group_id=5470


More information about the Python-bugs-list mailing list