summaryrefslogtreecommitdiffstats
path: root/Lib/email/_header_value_parser.py
diff options
context:
space:
mode:
authorJens Troeger <jenstroeger@users.noreply.github.com>2019-05-14 01:07:39 (GMT)
committerR. David Murray <rdmurray@bitdance.com>2019-05-14 01:07:39 (GMT)
commit45b2f8893c1b7ab3b3981a966f82e42beea82106 (patch)
tree9f8ae3a45d2280fe4cc6f0b2b8f9fb0f1c21e0f9 /Lib/email/_header_value_parser.py
parent8da5ebe11e0cb6599af682b22f7c2b2b7b9debd8 (diff)
downloadcpython-45b2f8893c1b7ab3b3981a966f82e42beea82106.zip
cpython-45b2f8893c1b7ab3b3981a966f82e42beea82106.tar.gz
cpython-45b2f8893c1b7ab3b3981a966f82e42beea82106.tar.bz2
bpo-34424: Handle different policy.linesep lengths correctly. (#8803)
Diffstat (limited to 'Lib/email/_header_value_parser.py')
-rw-r--r--Lib/email/_header_value_parser.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/email/_header_value_parser.py b/Lib/email/_header_value_parser.py
index 922daa2..bb26d5a 100644
--- a/Lib/email/_header_value_parser.py
+++ b/Lib/email/_header_value_parser.py
@@ -2625,7 +2625,7 @@ def _refold_parse_tree(parse_tree, *, policy):
want_encoding = False
last_ew = None
if part.syntactic_break:
- encoded_part = part.fold(policy=policy)[:-1] # strip nl
+ encoded_part = part.fold(policy=policy)[:-len(policy.linesep)]
if policy.linesep not in encoded_part:
# It fits on a single line
if len(encoded_part) > maxlen - len(lines[-1]):