diff options
author | Johannes Reiff <mail@jreiff.de> | 2021-08-09 16:45:41 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-09 16:45:41 (GMT) |
commit | b33186bc43bb5aaf652dd9d093a08fdde796d499 (patch) | |
tree | 5fa5ff110600d1a6f5fd5e4e68ffd72d3a059f00 /Lib/email/contentmanager.py | |
parent | d0978761118856e8ca8ea7b162a6585b8da83df9 (diff) | |
download | cpython-b33186bc43bb5aaf652dd9d093a08fdde796d499.zip cpython-b33186bc43bb5aaf652dd9d093a08fdde796d499.tar.gz cpython-b33186bc43bb5aaf652dd9d093a08fdde796d499.tar.bz2 |
bpo-41402: Fix email ContentManager calling .encode() on bytes (GH-21631)
Diffstat (limited to 'Lib/email/contentmanager.py')
-rw-r--r-- | Lib/email/contentmanager.py | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/Lib/email/contentmanager.py b/Lib/email/contentmanager.py index b91fb0e..3cf62dc 100644 --- a/Lib/email/contentmanager.py +++ b/Lib/email/contentmanager.py @@ -238,9 +238,7 @@ def set_bytes_content(msg, data, maintype, subtype, cte='base64', data = binascii.b2a_qp(data, istext=False, header=False, quotetabs=True) data = data.decode('ascii') elif cte == '7bit': - # Make sure it really is only ASCII. The early warning here seems - # worth the overhead...if you care write your own content manager :). - data.encode('ascii') + data = data.decode('ascii') elif cte in ('8bit', 'binary'): data = data.decode('ascii', 'surrogateescape') msg.set_payload(data) |