summaryrefslogtreecommitdiffstats
path: root/Lib/email/_header_value_parser.py
diff options
context:
space:
mode:
authorAbhilash Raj <maxking@users.noreply.github.com>2019-05-17 19:28:44 (GMT)
committerR. David Murray <rdmurray@bitdance.com>2019-05-17 19:28:44 (GMT)
commitfeac6cd7753425fba006e97e2d9b74a0c0c75894 (patch)
tree60e2974c9254ed17c8bc5e7bf952c1668ed36e77 /Lib/email/_header_value_parser.py
parentcbe72d842646ded2454784679231e3d1e6252e72 (diff)
downloadcpython-feac6cd7753425fba006e97e2d9b74a0c0c75894.zip
cpython-feac6cd7753425fba006e97e2d9b74a0c0c75894.tar.gz
cpython-feac6cd7753425fba006e97e2d9b74a0c0c75894.tar.bz2
bpo-33524: Fix the folding of email header when max_line_length is 0 or None (#13391)
and there are non-ascii characters in the header.
Diffstat (limited to 'Lib/email/_header_value_parser.py')
-rw-r--r--Lib/email/_header_value_parser.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/email/_header_value_parser.py b/Lib/email/_header_value_parser.py
index 60d0d32..649f153 100644
--- a/Lib/email/_header_value_parser.py
+++ b/Lib/email/_header_value_parser.py
@@ -68,6 +68,7 @@ XXX: provide complete list of token types.
"""
import re
+import sys
import urllib # For urllib.parse.unquote
from string import hexdigits
from operator import itemgetter
@@ -2590,7 +2591,7 @@ def _refold_parse_tree(parse_tree, *, policy):
"""
# max_line_length 0/None means no limit, ie: infinitely long.
- maxlen = policy.max_line_length or float("+inf")
+ maxlen = policy.max_line_length or sys.maxsize
encoding = 'utf-8' if policy.utf8 else 'us-ascii'
lines = ['']
last_ew = None