[3.13] gh-142006: Fix HeaderWriteError in email.policy.default caused by extra newline (GH-142008) (#142362)
gh-142006: Fix HeaderWriteError in email.policy.default caused by extra newline (GH-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 07eff899d8a8ee4c4b1be7cb223fe25687f6216c) Co-authored-by: Paresh Joshi <rahulj9223@gmail.com> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
M
Miss Islington (bot) committed
90ca216cdcb747e623864b66e83fef7947b03e4d
Parent: f28409c
Committed by GitHub <noreply@github.com>
on 12/6/2025, 9:40:07 PM