We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
buf
self._decompressor.needs_input
1 parent d7dbde8 commit 67db028Copy full SHA for 67db028
1 file changed
Lib/gzip.py
@@ -575,6 +575,10 @@ def read(self, size=-1):
575
# Read a chunk of data from the file
576
if self._decompressor.needs_input:
577
buf = self._fp.read(READ_BUFFER_SIZE)
578
+ if buf == b"":
579
+ raise EOFError("Compressed file ended before the "
580
+ "end-of-stream marker was reached")
581
+
582
uncompress = self._decompressor.decompress(buf, size)
583
else:
584
uncompress = self._decompressor.decompress(b"", size)
@@ -586,9 +590,6 @@ def read(self, size=-1):
586
590
587
591
if uncompress != b"":
588
592
break
589
- if buf == b"":
- raise EOFError("Compressed file ended before the "
- "end-of-stream marker was reached")
593
594
self._crc = zlib.crc32(uncompress, self._crc)
595
self._stream_size += len(uncompress)
0 commit comments