Repository navigation
gh-128949: Preserve payload line endings in BytesParser.parse - #157726
sankalpsthakur wants to merge 4 commits into
Conversation
|
Found a mailbox compatibility regression while investigating the Windows failures on 5a0df99: with CRLF storage, Maildir/MH now return CRLF payloads while A candidate follow-up keeps universal-newline conversion in |
|
The mailbox fix is in |
Link the documented class rather than its inherited parse method. The author reviewed and approved this one-line correction. AI-assisted: Codex.
|
The NEWS reference correction is now in |
db3d2c1 to
d19b94e
Compare
|
The email fix looks good, but I have my doubts about the mailbox change. It seems to me that it may be better to view this as a problem with the tests when run on windows. I remember needing to fix some email tests to handle being run on windows when binary support was re-introduced in the python3 email package. Which tests are failing without the mailbox.py adjustment? Related to the email fix: it seems like in a strict interpretation of the RFCs, if a CTE 7bit (the default) binary part contains bare LF, they should be converted to CRLF on binary part retrieval. The RFCs basically make bare LF technically illegal. In practical terms I don't think we want to do that; better to preserve what we are given, which this fix should do. |
|
thanks. without the mailbox.py hunk, 17 tests in test_mailbox fail on all seven windows jobs, all in TestMaildir and TestMH: test_add, test_add_8bit_body, test_get, test_get_message, test_getitem, test_pop, test_set_item and test_update in both, plus TestMaildir.test_set_MM (log at 5a0df99). bodies and folded headers come back with mailbox writes messages with agreed on bare lf: preserving what we're given seems right. |
Fixes #128949. Thanks to tnakamot and medmunds for the reports.
Preserve CRLF and bare CR bytes when parsing binary files with
BytesParserandBytesHeaderParser, so unencoded attachments agree withparsebytes(). Header recognition and ownership of the caller's stream are unchanged.The mailbox follow-up in
9634201retainsmailbox.Message's existing universal-newline behaviour for binary streams.004a504corrects the NEWS link to the documentedBytesHeaderParserclass without changing runtime code.Regression coverage includes both policies, payload/transfer-encoding variants, multipart attachments, an 8192-byte read boundary, header-only parsing and mailbox construction from streams/bytes.
All reported upstream checks pass on
004a504, including Docs, Doctest, EPUB, Windows, macOS, Linux and the required-check aggregate. Maintainer review remains. The NEWS correction also removed exactly the failing reference in local nitpicky Sphinx output; the repository's new-NEWS warning gate changed from exit 255 to 0, with no new warnings.AI tools assisted with implementation, validation and this description. The author reviewed and approved the latest correction.