MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / _read_eof

Method _read_eof

tools/python-3.11.9-amd64/Lib/gzip.py:529–548  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

527 self._stream_size = self._stream_size + len(data)
528
529 def _read_eof(self):
530 # We've read to the end of the file
531 # We check that the computed CRC and size of the
532 # uncompressed data matches the stored values. Note that the size
533 # stored is the true file size mod 2**32.
534 crc32, isize = struct.unpack("<II", _read_exact(self._fp, 8))
535 if crc32 != self._crc:
536 raise BadGzipFile("CRC check failed %s != %s" % (hex(crc32),
537 hex(self._crc)))
538 elif isize != (self._stream_size & 0xffffffff):
539 raise BadGzipFile("Incorrect length of data produced")
540
541 # Gzip files can be padded with zeroes and still have archives.
542 # Consume all zero bytes and set the file position to the first
543 # non-zero byte. See http://www.gzip.org/#faq8
544 c = b"\x00"
545 while c == b"\x00":
546 c = self._fp.read(1)
547 if c:
548 self._fp.prepend(c)
549
550 def _rewind(self):
551 super()._rewind()

Callers 1

readMethod · 0.95

Calls 5

_read_exactFunction · 0.85
BadGzipFileClass · 0.85
unpackMethod · 0.45
readMethod · 0.45
prependMethod · 0.45

Tested by

no test coverage detected