[issue20435] Discrepancy between io.StringIO and _pyio.StringIO with univeral newlines

Serhiy Storchaka report at bugs.python.org
Sun Feb 2 23:31:49 CET 2014


Serhiy Storchaka added the comment:

But how then other values of newline except '\n' can be useful?

The problem is that newline converting is applied twice, in write() and in read(). When constructor uses write() and getvalue() returns same value as read(), we have no chance to get newlines encoded or decoded only once. Current results for newline != '\n' looks meanless to me.

Here is my half-baked patch. It fixes only _pyio.StringIO, but _io.StringIO are still partially broken. The patch also contains new tests.

----------
Added file: http://bugs.python.org/file33876/stringio_newline.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20435>
_______________________________________


More information about the Python-bugs-list mailing list