summaryrefslogtreecommitdiffstats
path: root/Lib/email/mime
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2014-09-26 21:57:29 (GMT)
committerBerker Peksag <berker.peksag@gmail.com>2014-09-26 21:57:29 (GMT)
commitfe21e4d4d76d3fd1efd16d124808d72a69588d7b (patch)
tree74e47a453633ae97d05f98cf18aeb361edb951e8 /Lib/email/mime
parent081bbf6b28868774c1abca0a8469a517abb9f6cc (diff)
downloadcpython-fe21e4d4d76d3fd1efd16d124808d72a69588d7b.zip
cpython-fe21e4d4d76d3fd1efd16d124808d72a69588d7b.tar.gz
cpython-fe21e4d4d76d3fd1efd16d124808d72a69588d7b.tar.bz2
Issue #16324: _charset parameter of MIMEText now also accepts email.charset.Charset instances.
Initial patch by Claude Paroz.
Diffstat (limited to 'Lib/email/mime')
-rw-r--r--Lib/email/mime/text.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/email/mime/text.py b/Lib/email/mime/text.py
index ec18b85..479928e 100644
--- a/Lib/email/mime/text.py
+++ b/Lib/email/mime/text.py
@@ -6,6 +6,7 @@
__all__ = ['MIMEText']
+from email.charset import Charset
from email.mime.nonmultipart import MIMENonMultipart
@@ -34,6 +35,8 @@ class MIMEText(MIMENonMultipart):
_charset = 'us-ascii'
except UnicodeEncodeError:
_charset = 'utf-8'
+ if isinstance(_charset, Charset):
+ _charset = str(_charset)
MIMENonMultipart.__init__(self, 'text', _subtype,
**{'charset': _charset})