summaryrefslogtreecommitdiffstats
path: root/Lib/email
diff options
context:
space:
mode:
authormircea-cosbuc <mircea-cosbuc@users.noreply.github.com>2017-06-12 06:43:41 (GMT)
committerMariatta <Mariatta@users.noreply.github.com>2017-06-12 06:43:41 (GMT)
commitb459f7482612d340b88b62edc024628595ec6337 (patch)
tree8a1a2804b922adc48302acb7b720cc69135f0c71 /Lib/email
parent3fd54d4a7e604067e2bc0f8cfd58bdbdc09fa7f4 (diff)
downloadcpython-b459f7482612d340b88b62edc024628595ec6337.zip
cpython-b459f7482612d340b88b62edc024628595ec6337.tar.gz
cpython-b459f7482612d340b88b62edc024628595ec6337.tar.bz2
[email] bpo-29478: Fix passing max_line_length=None from Compat32 policy (GH-595)
If max_line_length=None is specified while using the Compat32 policy, it is no longer ignored.
Diffstat (limited to 'Lib/email')
-rw-r--r--Lib/email/_policybase.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/email/_policybase.py b/Lib/email/_policybase.py
index df46496..c9cbadd 100644
--- a/Lib/email/_policybase.py
+++ b/Lib/email/_policybase.py
@@ -361,8 +361,12 @@ class Compat32(Policy):
# Assume it is a Header-like object.
h = value
if h is not None:
- parts.append(h.encode(linesep=self.linesep,
- maxlinelen=self.max_line_length))
+ # The Header class interprets a value of None for maxlinelen as the
+ # default value of 78, as recommended by RFC 2822.
+ maxlinelen = 0
+ if self.max_line_length is not None:
+ maxlinelen = self.max_line_length
+ parts.append(h.encode(linesep=self.linesep, maxlinelen=maxlinelen))
parts.append(self.linesep)
return ''.join(parts)