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 barry, r.david.murray, vstinner
Date 2010-10-19.12:37:14
SpamBayes Score 1.16573e-15
Marked as misclassified No
Message-id <>
Having looked more carefully at the email4 (python2) code, I think I'm wrong.  The test I changed appears to codify the behavior expected when parsing a crlf file in binary mode.  This means that email4 code being ported to email5 may depend on that behavior.  So my initial statement was in fact correct: the email5 code as it stands is correct, it is the tests that are broken.

Fixing the tests so that they run on Windows may be hard enough that I end up just skipping that particular test class on Windows.  The difficulty arises from the fact that email uses '\n' when serializing headers, but the message bodies in binary mode will have the \r\n line endings if and only if the source used \r\n.  Since the source files for those tests are text, they have different line endings depending on the platform, and so the output of re-serializing the messages is different.  

Which means, in essence, that on Windows those test failures are correct failures:  binary parse/binary serialize are *not* inverses.  This is also, then, true for a binary parse of an RFC valid input stream, since the RFCs require \r\n line separators.  In Python2 this wasn't a problem because the file or data stream could be read as text using universal newline mode, thus obscuring the difference in the input line end discipline.  In Python3 this is not possible.

So, an alternative and perhaps better fix is to add a new feature to email5's BytesGenerator that allows the output line end character sequence to be specified.  This would have the additional advantage of closing issue 1349106, and would make it easier to interface with an as-yet-nonexistent binary input interface in smtplib.
Date User Action Args
2010-10-19 12:37:19r.david.murraysetrecipients: + r.david.murray, barry, vstinner
2010-10-19 12:37:19r.david.murraysetmessageid: <>
2010-10-19 12:37:16r.david.murraylinkissue10134 messages
2010-10-19 12:37:14r.david.murraycreate