diff options
author | Mark Sapiro <mark@msapiro.net> | 2020-07-08 21:00:35 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-08 21:00:35 (GMT) |
commit | 4fa61a7732923f92de0f7830c12da48c4cec937f (patch) | |
tree | d30bb0fc4c447bab77c7d376886ff23fb3e90e47 /Lib/email | |
parent | 61fc23ca106bc82955b0e59d1ab42285b94899e2 (diff) | |
download | cpython-4fa61a7732923f92de0f7830c12da48c4cec937f.zip cpython-4fa61a7732923f92de0f7830c12da48c4cec937f.tar.gz cpython-4fa61a7732923f92de0f7830c12da48c4cec937f.tar.bz2 |
bpo-40597: Allow email.contextmanager set_content() to set a null string. (GH-20542)
Diffstat (limited to 'Lib/email')
-rw-r--r-- | Lib/email/contentmanager.py | 2 |
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: |