This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author r.david.murray
Recipients r.david.murray
Date 2012-04-22.17:57:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1335117428.2.0.322445942387.issue14645@psf.upfronthosting.co.za>
In-reply-to
Content
I ran into this while translating a test, but it turns out it is a long standing problem.  I presume it has not been an issue because in general in Python2 email messages are read as text with universal newline support, and thus the linesep characters get translated on *read*, and the problem in Generator never shows up.  In python3, however, we will often read messages as binary, which will preserve the existing linesep characters, and expose the Generator bug.  

This isn't a critical bug for Python3 only because if a message is read in binary it will likely be written in binary using \r\n linesep, in which case the right thing will be happening.  Likewise most messages read from disk will be written to disk.  But it should be fixed so that the cases where a message is read in binary and written to disk in text and vice versa are correctly formatted.  (In particular, uses of the new smtplib.send_message could theoretically run in to this, though I haven't tested to see if that is really a problem.)

To reproduce, read data/msg_26.txt from the email test suite in binary mode (or text mode using "linesep='\n'", which will preserve the crlf in that file), and run str on the resulting message.  You'll see that the MIME preamble and the base64 part both have \r\n linesep, instead of the default '\n' linesep used for the rest of the message.
History
Date User Action Args
2012-04-22 17:57:08r.david.murraysetrecipients: + r.david.murray
2012-04-22 17:57:08r.david.murraysetmessageid: <1335117428.2.0.322445942387.issue14645@psf.upfronthosting.co.za>
2012-04-22 17:57:07r.david.murraylinkissue14645 messages
2012-04-22 17:57:07r.david.murraycreate