Commit e6103414 authored by Stefan Behnel's avatar Stefan Behnel

fix newline normalisation on stream.readlines() for Py<=2.5

parent 4b1ae971
...@@ -106,7 +106,7 @@ normalise_newlines = re.compile(u'\r\n?|\n').sub ...@@ -106,7 +106,7 @@ normalise_newlines = re.compile(u'\r\n?|\n').sub
class NormalisedNewlineStream(object): class NormalisedNewlineStream(object):
"""The codecs module doesn't provide universal newline support. """The codecs module doesn't provide universal newline support.
This class is used as a stream wrapper that provides this This class is used as a stream wrapper that provides this
functionality. The new 'io' in Py2.6+/3.1+ supports this out of the functionality. The new 'io' in Py2.6+/3.x supports this out of the
box. box.
""" """
def __init__(self, stream): def __init__(self, stream):
...@@ -126,10 +126,10 @@ class NormalisedNewlineStream(object): ...@@ -126,10 +126,10 @@ class NormalisedNewlineStream(object):
def readlines(self): def readlines(self):
content = [] content = []
data = self._read(0x1000) data = self.read(0x1000)
while data: while data:
content.append(data) content.append(data)
data = self._read(0x1000) data = self.read(0x1000)
return u''.join(content).split(u'\n') return u''.join(content).split(u'\n')
io = None io = None
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment