diff options
author | Berker Peksag <berker.peksag@gmail.com> | 2016-09-08 19:42:11 +0300 |
---|---|---|
committer | Berker Peksag <berker.peksag@gmail.com> | 2016-09-08 19:42:11 +0300 |
commit | 267737a99496a3f4557863bec04fd6ebedf14db8 (patch) | |
tree | dc4648cd06f680c985c12b267bf4cee4f9b60012 | |
parent | b799c960150c910abd8e633001f14079a6360a7e (diff) | |
parent | 8daf04797b939fcd4776ae61cb1d2bcaa01c7da3 (diff) | |
download | cpython-267737a99496a3f4557863bec04fd6ebedf14db8.tar.gz |
Issue #27445: Merge from 3.5
-rw-r--r-- | Lib/email/mime/text.py | 4 | ||||
-rw-r--r-- | Lib/test/test_email/test_email.py | 5 | ||||
-rw-r--r-- | Misc/NEWS | 3 |
3 files changed, 8 insertions, 4 deletions
diff --git a/Lib/email/mime/text.py b/Lib/email/mime/text.py index 87de8d235f..35b4423830 100644 --- a/Lib/email/mime/text.py +++ b/Lib/email/mime/text.py @@ -35,10 +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, policy=policy, - **{'charset': _charset}) + **{'charset': str(_charset)}) self.set_payload(_text, _charset) diff --git a/Lib/test/test_email/test_email.py b/Lib/test/test_email/test_email.py index 30ea77f208..529d3ef0e3 100644 --- a/Lib/test/test_email/test_email.py +++ b/Lib/test/test_email/test_email.py @@ -1653,9 +1653,12 @@ class TestMIMEText(unittest.TestCase): eq(msg.get_charset().input_charset, 'us-ascii') eq(msg['content-type'], 'text/plain; charset="us-ascii"') # Also accept a Charset instance - msg = MIMEText('hello there', _charset=Charset('utf-8')) + charset = Charset('utf-8') + charset.body_encoding = None + msg = MIMEText('hello there', _charset=charset) eq(msg.get_charset().input_charset, 'utf-8') eq(msg['content-type'], 'text/plain; charset="utf-8"') + eq(msg.get_payload(), 'hello there') def test_7bit_input(self): eq = self.assertEqual @@ -92,6 +92,9 @@ Core and Builtins Library ------- +- Issue #27445: Don't pass str(_charset) to MIMEText.set_payload(). + Patch by Claude Paroz. + - Issue #24277: The new email API is no longer provisional, and the docs have been reorganized and rewritten to emphasize the new API. |