Skip to content

[3.13] gh-142006: Fix HeaderWriteError in email.policy.default caused by extra newline (GH-142008)#142362

Merged
bitdancer merged 1 commit intopython:3.13from
miss-islington:backport-07eff89-3.13
Dec 6, 2025
Merged

[3.13] gh-142006: Fix HeaderWriteError in email.policy.default caused by extra newline (GH-142008)#142362
bitdancer merged 1 commit intopython:3.13from
miss-islington:backport-07eff89-3.13

Conversation

@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Dec 6, 2025

RDM: This fixes a subtle folding error that showed up when a token exactly filled a line and was followed by whitespace and a token with no folding whitespace that was longer than a line. In this particular circumstance the whitespace after the first token got pushed on to the next line, and then stolen to go in front of the next unfoldable token...leaving a completely empty line in the line buffer. That line got turned in to a newline, which is RFC illegal, and the newish security check caught it. The fix is to just delete that empty line from the buffer.
(cherry picked from commit 07eff89)

Co-authored-by: Paresh Joshi [email protected]
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>

…by extra newline (pythonGH-142008)

RDM: This fixes a subtle folding error that showed up when a token exactly filled a line and was followed by whitespace and a token with no folding whitespace that was longer than a line.  In this particular circumstance the whitespace after the first token got pushed on to the next line, and then stolen to go in front of the next unfoldable token...leaving a completely empty line in the line buffer.  That line got turned in to a newline, which is RFC illegal, and the newish security check caught it.  The fix is to just delete that empty line from the buffer.
(cherry picked from commit 07eff89)

Co-authored-by: Paresh Joshi <[email protected]>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
@miss-islington miss-islington requested a review from a team as a code owner December 6, 2025 20:59
@bitdancer bitdancer merged commit 90ca216 into python:3.13 Dec 6, 2025
74 of 76 checks passed
@miss-islington miss-islington deleted the backport-07eff89-3.13 branch January 2, 2026 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants