diff --git a/Lib/gzip.py b/Lib/gzip.py index a550c20a7a08baf..959c3cb58fdcd33 100644 --- a/Lib/gzip.py +++ b/Lib/gzip.py @@ -551,10 +551,10 @@ def read(self, size=-1): # Read a chunk of data from the file if self._decompressor.needs_input: buf = self._fp.read(READ_BUFFER_SIZE) - uncompress = self._decompressor.decompress(buf, size) else: - uncompress = self._decompressor.decompress(b"", size) + buf = b"" + uncompress = self._decompressor.decompress(buf, size) if self._decompressor.unused_data != b"": # Prepend the already read bytes to the fileobj so they can # be seen by _read_eof() and _read_gzip_header()