You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2013-02-11.16:21:56.996>created_at=<Date2013-02-09.18:19:45.072>labels= ['type-bug', 'expert-email']
title='email.encoders.encode7or8bit does not work with binary data'updated_at=<Date2013-02-11.16:21:56.995>user='https://github.com/bitdancer'
>>> import io, email
>>> bytesdata =b'\xfa\xfb\xfc\xfd\xfe\xff'
>>> msg = email.mime.application.MIMEApplication(bytesdata, _encoder=encoders.encode_7or8bit)
>>> s = io.BytesIO()
>>> g = email.generator.BytesGenerator(s)
>>> g.flatten(msg)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/serhiy/py/cpython3.2/Lib/email/generator.py", line 91, in flatten
self._write(msg)
File "/home/serhiy/py/cpython3.2/Lib/email/generator.py", line 137, in _write
self._dispatch(msg)
File "/home/serhiy/py/cpython3.2/Lib/email/generator.py", line 163, in _dispatch
meth(msg)
File "/home/serhiy/py/cpython3.2/Lib/email/generator.py", line 393, in _handle_text
if _has_surrogates(msg._payload):
TypeError: can't use a string pattern on a bytes-like object
Since this was straightforwardly similar to the bpo-16564 fix I didn't bother with a review. The 2.7 commit is backporting the behavior-confirming test, just for thoroughness.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: