summaryrefslogtreecommitdiffstats
path: root/Lib/email/message.py
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2013-08-22 01:13:51 (GMT)
committerR David Murray <rdmurray@bitdance.com>2013-08-22 01:13:51 (GMT)
commitb8c537094d52dc07434df757c4c29c0f6c6e76d4 (patch)
tree749de3324b11d8af63dbda2e096b6e8a7a9dc329 /Lib/email/message.py
parentcba2e3c2e9f219043ddef0a896748f50691b3c47 (diff)
parent00ae435deef434f471e39bea3f3ab3a3e3cd90fe (diff)
downloadcpython-b8c537094d52dc07434df757c4c29c0f6c6e76d4.zip
cpython-b8c537094d52dc07434df757c4c29c0f6c6e76d4.tar.gz
cpython-b8c537094d52dc07434df757c4c29c0f6c6e76d4.tar.bz2
Merge #18324: set_payload now correctly handles binary input.
Diffstat (limited to 'Lib/email/message.py')
-rw-r--r--Lib/email/message.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/email/message.py b/Lib/email/message.py
index b5f7b3a..ebaf1c1 100644
--- a/Lib/email/message.py
+++ b/Lib/email/message.py
@@ -303,6 +303,8 @@ class Message:
Optional charset sets the message's default character set. See
set_charset() for details.
"""
+ if isinstance(payload, bytes):
+ payload = payload.decode('ascii', 'surrogateescape')
self._payload = payload
if charset is not None:
self.set_charset(charset)