summaryrefslogtreecommitdiff
path: root/Lib/gzip.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/gzip.py')
-rw-r--r--Lib/gzip.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/gzip.py b/Lib/gzip.py
index 8b8942642e..5bcfe6123a 100644
--- a/Lib/gzip.py
+++ b/Lib/gzip.py
@@ -385,7 +385,10 @@ class GzipFile(io.BufferedIOBase):
return b''
try:
- self._read()
+ # For certain input data, a single call to _read() may not return
+ # any data. In this case, retry until we get some data or reach EOF.
+ while self.extrasize <= 0:
+ self._read()
except EOFError:
pass
if size < 0 or size > self.extrasize: