summaryrefslogtreecommitdiff
path: root/Lib/gzip.py
diff options
context:
space:
mode:
authorNadeem Vawda <nadeem.vawda@gmail.com>2012-08-05 14:45:41 +0200
committerNadeem Vawda <nadeem.vawda@gmail.com>2012-08-05 14:45:41 +0200
commit043540088ae75f79179de2fe4ec147674bcc2a5f (patch)
tree5bad89b4fe613e1552247a128b59bf7a8bb44ae8 /Lib/gzip.py
parente3ded955f3b145e38be47be61c53ba1ff130f47b (diff)
downloadcpython-git-043540088ae75f79179de2fe4ec147674bcc2a5f.tar.gz
#15546: Also fix GzipFile.peek().
Diffstat (limited to 'Lib/gzip.py')
-rw-r--r--Lib/gzip.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/gzip.py b/Lib/gzip.py
index 5bcfe6123a..b6656a933e 100644
--- a/Lib/gzip.py
+++ b/Lib/gzip.py
@@ -413,8 +413,10 @@ class GzipFile(io.BufferedIOBase):
if self.fileobj is None:
return b''
try:
- # 1024 is the same buffering heuristic used in read()
- self._read(max(n, 1024))
+ # Ensure that we don't return b"" if we haven't reached EOF.
+ while self.extrasize == 0:
+ # 1024 is the same buffering heuristic used in read()
+ self._read(max(n, 1024))
except EOFError:
pass
offset = self.offset - self.extrastart