From c11d6f13ae2f83702f7ed8a26618eb378918c881 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Wed, 25 Aug 2004 10:52:58 +0000 Subject: [PATCH] Patch #1014992: Never return more than a line from readline. Will backport to 2.3. --- Lib/tarfile.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Lib/tarfile.py b/Lib/tarfile.py index 2d5bf642aef..06d859087bd 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