(self)
| 594 | return uncompress |
| 595 | |
| 596 | def _read_eof(self): |
| 597 | # We've read to the end of the file |
| 598 | # We check that the computed CRC and size of the |
| 599 | # uncompressed data matches the stored values. Note that the size |
| 600 | # stored is the true file size mod 2**32. |
| 601 | crc32, isize = struct.unpack("<II", _read_exact(self._fp, 8)) |
| 602 | if crc32 != self._crc: |
| 603 | raise BadGzipFile("CRC check failed %s != %s" % (hex(crc32), |
| 604 | hex(self._crc))) |
| 605 | elif isize != (self._stream_size & 0xffffffff): |
| 606 | raise BadGzipFile("Incorrect length of data produced") |
| 607 | |
| 608 | # Gzip files can be padded with zeroes and still have archives. |
| 609 | # Consume all zero bytes and set the file position to the first |
| 610 | # non-zero byte. See http://www.gzip.org/#faq8 |
| 611 | c = b"\x00" |
| 612 | while c == b"\x00": |
| 613 | c = self._fp.read(1) |
| 614 | if c: |
| 615 | self._fp.prepend(c) |
| 616 | |
| 617 | def _rewind(self): |
| 618 | super()._rewind() |
no test coverage detected