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.1657342e-15
Marked as misclassified No
Message-id <1287491839.11.0.23376335025.issue10134@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
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: <1287491839.11.0.23376335025.issue10134@psf.upfronthosting.co.za>
2010-10-19 12:37:16r.david.murraylinkissue10134 messages
2010-10-19 12:37:14r.david.murraycreate