msg82132 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2009-02-14 22:36 |
This one is a bit strange: >>> f = io.StringIO("a\r\nb\r\n", newline=None) >>> f.read() 'a\nb\n' >>> f = io.StringIO("a\r\nb\r\n", newline=None) >>> f.read(6) 'a\nb\n' >>> f = io.StringIO("a\r\nb\r\n", newline=None) >>> f.read(5) 'a\n\nb\n' |
|
|
msg83143 - (view) |
Author: Benjamin Peterson (benjamin.peterson) *  |
Date: 2009-03-04 21:38 |
This is fixed by the io-c branch merge. (r70152) |
|
|
msg87599 - (view) |
Author: Jason R. Coombs (jaraco) *  |
Date: 2009-05-12 01:14 |
Although this was fixed for 3.1, it appears not to be fixed for Python 2.6 or 2.7. PS C:\Users\jaraco> python Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import io >>> io.StringIO('foo\r\nbar\r\n', newline=None).read() u'foo\n\nbar\n\n' Note that this behavior is slightly different from what pitrou reported. If this cannot be fixed in 2.6, the documentation should at least reflect that it doesn't work until a later version. |
|
|
msg87603 - (view) |
Author: Alexandre Vassalotti (alexandre.vassalotti) *  |
Date: 2009-05-12 03:22 |
The bug shouldn't affect 2.6 and 2.7 unless you backported the now obsolete _stringio module from 3.0. I tested 2.6 and 2.7 and as expected I didn't see the bug: Python 2.6.2+ (release26-maint:72576, May 11 2009, 23:16:48) [GCC 4.3.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import io >>> io.StringIO('foo\r\nbar\r\n', newline=None).read() u'foo\nbar\n' |
|
|
msg87620 - (view) |
Author: Jason R. Coombs (jaraco) *  |
Date: 2009-05-12 13:07 |
Perhaps I was wrong about 2.7. However, I'm using stock builds of Python 2.6.2 for Windows, both 32- and 64-bit, and I get the undesirable behavior. Apparently the problem is platform-specific. Should this issue go under a new ticket? |
|
|
msg87657 - (view) |
Author: Alexandre Vassalotti (alexandre.vassalotti) *  |
Date: 2009-05-12 20:00 |
> Should this issue go under a new ticket? Yes, it would be preferable as the issue is probably not specific to io.StringIO. Also, make sure that you include the result of this test-case: open("testnl.txt", "wb").write("foo\r\nbar\r\n") open("testnl.txt", "rU").read() |
|
|
msg88439 - (view) |
Author: Jason R. Coombs (jaraco) *  |
Date: 2009-05-27 20:02 |
I've filed the Windows issue as http://bugs.python.org/issue6127 |
|
|