-
Notifications
You must be signed in to change notification settings - Fork 293
Closed
Description
How to reproduce:
Python2 with latest future
>>> from builtins import str
>>> from future.backports.email.mime.text import MIMEText
>>> m = MIMEText('x')
>>> m['x'] = str(u'ó')
>>> m.as_string()
... snip ...
AttributeError: encode method has been disabled in newbytes
Python3:
>>> from email.mime.text import MIMEText
>>> m = MIMEText('x')
>>> m['x'] = str(u'ó')
>>> m.as_string()
'Content-Type: text/plain; charset="us-ascii"\nMIME-Version: 1.0\nContent-Transfer-Encoding: 7bit\nx: =?utf-8?b?w7M=?=\n\nx'
I suspect that the cause is missing builtins.str
import in https://github.com/PythonCharmers/python-future/blob/master/src/future/backports/email/base64mime.py.
Native str
is being used in isinstance
check in this module:
https://github.com/PythonCharmers/python-future/blob/master/src/future/backports/email/base64mime.py#L72
Metadata
Metadata
Assignees
Labels
No labels