summaryrefslogtreecommitdiffstats
path: root/Lib/email
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2020-07-08 21:18:38 (GMT)
committerGitHub <noreply@github.com>2020-07-08 21:18:38 (GMT)
commitc1c50345933efca42169f03d79ff4fe3d9c06bdc (patch)
treee948cb0defa8074bda4e5352df28d51b338e1131 /Lib/email
parentc8b599ff0a4e4782e97e353a20146d3570845dbc (diff)
downloadcpython-c1c50345933efca42169f03d79ff4fe3d9c06bdc.zip
cpython-c1c50345933efca42169f03d79ff4fe3d9c06bdc.tar.gz
cpython-c1c50345933efca42169f03d79ff4fe3d9c06bdc.tar.bz2
bpo-40597: Allow email.contextmanager set_content() to set a null string. (GH-20542)
(cherry picked from commit 4fa61a7732923f92de0f7830c12da48c4cec937f) Co-authored-by: Mark Sapiro <mark@msapiro.net>
Diffstat (limited to 'Lib/email')
-rw-r--r--Lib/email/contentmanager.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/email/contentmanager.py b/Lib/email/contentmanager.py
index 2b4b875..b91fb0e 100644
--- a/Lib/email/contentmanager.py
+++ b/Lib/email/contentmanager.py
@@ -146,7 +146,7 @@ def _encode_text(string, charset, cte, policy):
def normal_body(lines): return b'\n'.join(lines) + b'\n'
if cte==None:
# Use heuristics to decide on the "best" encoding.
- if max(len(x) for x in lines) <= policy.max_line_length:
+ if max((len(x) for x in lines), default=0) <= policy.max_line_length:
try:
return '7bit', normal_body(lines).decode('ascii')
except UnicodeDecodeError: