[issue31271] an assertion failure in io.TextIOWrapper.write

Oren Milman report at bugs.python.org
Tue Oct 3 02:57:58 EDT 2017


Oren Milman <orenmn at gmail.com> added the comment:

I am not sure, but ISTM that it isn't possible for the encoder to return a
unicode and not fail later.
This is because _textiowrapper_writeflush() would call _io.BytesIO.write()
(after it called _PyBytes_Join()), and bytesio_write() calls PyObject_GetBuffer(),
which would raise "TypeError: 'unicode' does not have the buffer interface".

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31271>
_______________________________________


More information about the Python-bugs-list mailing list