From: Martin v. Löwis Date: Wed, 25 Aug 2004 10:53:30 +0000 (+0000) Subject: Patch #1014992: Never return more than a line from readline. X-Git-Tag: v2.3.5c1~122 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b8005862f42bf9aabbf0e06a112076a0dd7eff21;p=thirdparty%2FPython%2Fcpython.git Patch #1014992: Never return more than a line from readline. --- diff --git a/Lib/tarfile.py b/Lib/tarfile.py index 327ba365e605..38c50b205e9b 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 diff --git a/Misc/NEWS b/Misc/NEWS index fa41a18c682c..f64e33a47182 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -51,6 +51,8 @@ Extension modules Library ------- +- Patch #1014992: In tarfile.readline, never return more than a line. + - Bug #1013882: Flush bz2 data even if nothing had been written so far. - Patch #997284: Allow pydoc to work with XP Themes (.manifest file)