summaryrefslogtreecommitdiffstats
path: root/Lib/email/message.py
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2007-08-30 02:10:49 (GMT)
committerBarry Warsaw <barry@python.org>2007-08-30 02:10:49 (GMT)
commit8b3d659692b6d092991dc3b5b4042547f885fa8c (patch)
tree49fc0c7a89c31479389f2dfb38d71f519ba4cb23 /Lib/email/message.py
parentce36ad8a467d914eb5c91f33835b9eaea18ee93b (diff)
downloadcpython-8b3d659692b6d092991dc3b5b4042547f885fa8c.zip
cpython-8b3d659692b6d092991dc3b5b4042547f885fa8c.tar.gz
cpython-8b3d659692b6d092991dc3b5b4042547f885fa8c.tar.bz2
Fix a more bytes/str confusion.
Use str.encode('raw-unicode-escape') consistently instead of bytes(string). Remove the convert_eols argument from base64mime.decode(). This matches previous API changes done to the quoprimime module.
Diffstat (limited to 'Lib/email/message.py')
-rw-r--r--Lib/email/message.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/email/message.py b/Lib/email/message.py
index 539af90..ad795f9 100644
--- a/Lib/email/message.py
+++ b/Lib/email/message.py
@@ -201,7 +201,7 @@ class Message:
# Incorrect padding
pass
elif cte in ('x-uuencode', 'uuencode', 'uue', 'x-uue'):
- in_file = BytesIO(bytes(payload + '\n'))
+ in_file = BytesIO((payload + '\n').encode('raw-unicode-escape'))
out_file = BytesIO()
try:
uu.decode(in_file, out_file, quiet=True)
@@ -757,7 +757,8 @@ class Message:
# LookupError will be raised if the charset isn't known to
# Python. UnicodeError will be raised if the encoded text
# contains a character not in the charset.
- charset = str(bytes(charset[2]), pcharset)
+ as_bytes = charset[2].encode('raw-unicode-escape')
+ charset = str(as_bytes, pcharset)
except (LookupError, UnicodeError):
charset = charset[2]
# charset characters must be in us-ascii range