[New-bugs-announce] [issue6127] Unexpected universal newline behavior (newline duplication) in Windows

Jason R. Coombs report at bugs.python.org
Wed May 27 22:01:43 CEST 2009


New submission from Jason R. Coombs <jaraco at jaraco.com>:

Per http://bugs.python.org/issue5265, I'm opening up a new ticket. 
Universal newline behavior works as expected under Linux but differently
under Windows.

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
>>> import io
>>> io.StringIO('foo\r\nbar\r\n', newline=None).read()
u'foo\n\nbar\n\n'

As you can see, the newlines get duplicated.

The problem doesn't seem to be with universal newline support in
general, but the StringIO implementation in particular.

PS C:\Users\jaraco\projects\formworx> python
Python 2.6.2 (r262:71605, Apr 14 2009, 22:46:50) [MSC v.1500 64 bit
(AMD64)] on win32
>>> open("testnl.txt", "wb").write("foo\r\nbar\r\n")
>>> open("testnl.txt", "rU").read()
'foo\nbar\n'

----------
components: IO
messages: 88438
nosy: jaraco
severity: normal
status: open
title: Unexpected universal newline behavior (newline duplication) in Windows
versions: Python 2.6

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


More information about the New-bugs-announce mailing list