summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2004-08-25 10:52:58 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2004-08-25 10:52:58 (GMT)
commitc11d6f13ae2f83702f7ed8a26618eb378918c881 (patch)
tree951f7ca5d26ea58b082af63dbac0e9db4e392b1b /Lib
parent8d494f3241f8a731f959ed1573b95b3a80bb4932 (diff)
downloadcpython-c11d6f13ae2f83702f7ed8a26618eb378918c881.zip
cpython-c11d6f13ae2f83702f7ed8a26618eb378918c881.tar.gz
cpython-c11d6f13ae2f83702f7ed8a26618eb378918c881.tar.bz2
Patch #1014992: Never return more than a line from readline.
Will backport to 2.3.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/tarfile.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/Lib/tarfile.py b/Lib/tarfile.py
index 2d5bf64..06d8590 100644
--- a/Lib/tarfile.py
+++ b/Lib/tarfile.py
@@ -509,14 +509,12 @@ class ExFileObject(object):
nl = min(nl, size)
else:
size -= len(self.linebuffer)
- while nl < 0:
+ while (nl < 0 and size > 0):
buf = self.read(min(size, 100))
if not buf:
break
self.linebuffer += buf
size -= len(buf)
- if size <= 0:
- break
nl = self.linebuffer.find("\n")
if nl == -1:
s = self.linebuffer