aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Hillacre <joel@403forbidden.ca>2017-06-26 15:41:35 -0600
committerR. David Murray <rdmurray@bitdance.com>2017-06-26 17:41:35 -0400
commitb350c22ebcbb891412e0b334afc9f0db19534e06 (patch)
tree1b53241cf239c66a84da3c4d328d87ec7cd0b46a /Lib/email/_header_value_parser.py
parentbpo-30765: Avoid blocking when PyThread_acquire_lock() is asked not to (#2403) (diff)
downloadcpython-b350c22ebcbb891412e0b334afc9f0db19534e06.tar.gz
cpython-b350c22ebcbb891412e0b334afc9f0db19534e06.tar.bz2
cpython-b350c22ebcbb891412e0b334afc9f0db19534e06.zip
bpo-30532: Fix whitespace folding in certain cases
Leading whitespace was incorrectly dropped during folding of certain lines in the _header_value_parser's folding algorithm. This makes the whitespace handling code consistent.
Diffstat (limited to 'Lib/email/_header_value_parser.py')
-rw-r--r--Lib/email/_header_value_parser.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/Lib/email/_header_value_parser.py b/Lib/email/_header_value_parser.py
index 57d01fbcb0f..9b9697f7734 100644
--- a/Lib/email/_header_value_parser.py
+++ b/Lib/email/_header_value_parser.py
@@ -341,9 +341,7 @@ class TokenList(list):
# avoid infinite recursion.
ws = part.pop_leading_fws()
if ws is not None:
- # Peel off the leading whitespace and make it sticky, to
- # avoid infinite recursion.
- folded.stickyspace = str(part.pop(0))
+ folded.stickyspace = str(ws)
if folded.append_if_fits(part):
continue
if part.has_fws: