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

SourceForge.net noreply at sourceforge.net
Mon Oct 6 09:33:29 EDT 2003


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

Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Jonathan Perez (jbperez808)
Assigned to: Nobody/Anonymous (nobody)
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 13: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