New submission from R. David Murray: Reported by Serhiy in issue 16564:
>>> 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 ---------- components: email messages: 181748 nosy: barry, r.david.murray priority: normal severity: normal stage: needs patch status: open title: email.encoders.encode7or8bit does not work with binary data versions: Python 3.2, Python 3.3, Python 3.4 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue17171> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com