summaryrefslogtreecommitdiffstats
path: root/Lib/email/policy.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/policy.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/policy.py')
-rw-r--r--Lib/email/policy.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/email/policy.py b/Lib/email/policy.py
index 5131311ac..611deb5 100644
--- a/Lib/email/policy.py
+++ b/Lib/email/policy.py
@@ -3,6 +3,7 @@ code that adds all the email6 features.
"""
import re
+import sys
from email._policybase import Policy, Compat32, compat32, _extend_docstrings
from email.utils import _has_surrogates
from email.headerregistry import HeaderRegistry as HeaderRegistry
@@ -203,7 +204,7 @@ class EmailPolicy(Policy):
def _fold(self, name, value, refold_binary=False):
if hasattr(value, 'name'):
return value.fold(policy=self)
- maxlen = self.max_line_length if self.max_line_length else float('inf')
+ maxlen = self.max_line_length if self.max_line_length else sys.maxsize
lines = value.splitlines()
refold = (self.refold_source == 'all' or
self.refold_source == 'long' and