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

2014-02-02 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thank you for fixing this bug. Maybe I reported it too hastily. -- ___ Python tracker ___ ___ Pyth

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

2014-02-02 Thread Antoine Pitrou
Antoine Pitrou added the comment: I've fixed the reported bug. If other problems need fixing, better open a new issue :-) -- resolution: -> fixed stage: -> committed/rejected status: open -> closed ___ Python tracker

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

2014-02-02 Thread Roundup Robot
Roundup Robot added the comment: New changeset 3e61d8e06ef7 by Antoine Pitrou in branch '2.7': Issue #20435: Fix _pyio.StringIO.getvalue() to take into account newline translation settings. http://hg.python.org/cpython/rev/3e61d8e06ef7 -- ___ Python

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

2014-02-02 Thread Roundup Robot
Roundup Robot added the comment: New changeset 99168e7d4a3d by Antoine Pitrou in branch '3.3': Issue #20435: Fix _pyio.StringIO.getvalue() to take into account newline translation settings. http://hg.python.org/cpython/rev/99168e7d4a3d New changeset aadcc71a4967 by Antoine Pitrou in branch 'def

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

2014-02-02 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Current results for newline != '\n' looks meanless to me. They don't look meaningless to me, e.g.: >>> io.StringIO("a\r\nc\rd", newline=None).getvalue() 'a\nc\nd' >>> sio = io.StringIO(newline=None); sio.write("a\r\nc\rd"); sio.getvalue() 6 'a\nc\nd' There m

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

2014-02-02 Thread Serhiy Storchaka
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 en

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

2014-02-02 Thread Antoine Pitrou
Antoine Pitrou added the comment: In other words, the bug is that _pyio.StringIO.getvalue() doesn't do any newline conversion; the patch fixes that. -- ___ Python tracker ___ __

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

2014-02-02 Thread Antoine Pitrou
Antoine Pitrou added the comment: With the patch, getvalue() is consistent with read() and other methods. Without the patch, _pyio.StringIO.getvalue() returns a different value from _pyio.StringIO.read() *and* from _io.StringIO.getvalue(). Changing _pyio.StringIO.getvalue() is the path of least

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

2014-02-02 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I rather think that it's a bug in _io.StringIO.getvalue(). -- ___ Python tracker ___ ___ Python-bu

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

2014-02-02 Thread Antoine Pitrou
Antoine Pitrou added the comment: It's a bug in _pyio.StringIO.getvalue(). Attaching patch. -- keywords: +patch Added file: http://bugs.python.org/file33873/stringio_getvalue.patch ___ Python tracker __

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

2014-01-29 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: >>> import io, _pyio >>> io.StringIO('a\nb\r\nc\rd', newline=None) <_io.StringIO object at 0xb707c734> >>> io.StringIO('a\nb\r\nc\rd', newline=None).getvalue() 'a\nb\nc\nd' >>> _pyio.StringIO('a\nb\r\nc\rd', newline=None).getvalue() 'a\nb\r\nc\rd' >>> s = io.