Commit c11d6f13 authored by Martin v. Löwis's avatar Martin v. Löwis

Patch #1014992: Never return more than a line from readline.

Will backport to 2.3.
parent 8d494f32
...@@ -509,14 +509,12 @@ class ExFileObject(object): ...@@ -509,14 +509,12 @@ class ExFileObject(object):
nl = min(nl, size) nl = min(nl, size)
else: else:
size -= len(self.linebuffer) size -= len(self.linebuffer)
while nl < 0: while (nl < 0 and size > 0):
buf = self.read(min(size, 100)) buf = self.read(min(size, 100))
if not buf: if not buf:
break break
self.linebuffer += buf self.linebuffer += buf
size -= len(buf) size -= len(buf)
if size <= 0:
break
nl = self.linebuffer.find("\n") nl = self.linebuffer.find("\n")
if nl == -1: if nl == -1:
s = self.linebuffer s = self.linebuffer
......
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