Path 1: 206 calls (0.79)

1def _read_eof(self):
2        # We've read to the end of the file
3        # We check that the computed CRC and size of the
4        # uncompressed data matches the stored values.  Note that the size
5        # stored is the true file size mod 2**32.
6        crc32, isize = struct.unpack("<II", self._read_exact(8))
7        if crc32 != self._crc:
8            raise BadGzipFile("CRC check failed %s != %s" % (hex(crc32),
9                                                             hex(self._crc)))
10        elif isize != (self._stream_size & 0xffffffff):
11            raise BadGzipFile("Incorrect length of data produced")
12
13        # Gzip files can be padded with zeroes and still have archives.
14        # Consume all zero bytes and set the file position to the first
15        # non-zero byte. See http://www.gzip.org/#faq8
16        c = b"\x00"
17        while c == b"\x00":
18            c = self._fp.read(1)
19        if c:
20            self._fp.prepend(c)
            

Path 2: 54 calls (0.21)

1def _read_eof(self):
2        # We've read to the end of the file
3        # We check that the computed CRC and size of the
4        # uncompressed data matches the stored values.  Note that the size
5        # stored is the true file size mod 2**32.
6        crc32, isize = struct.unpack("<II", self._read_exact(8))
7        if crc32 != self._crc:
8            raise BadGzipFile("CRC check failed %s != %s" % (hex(crc32),
9                                                             hex(self._crc)))
10        elif isize != (self._stream_size & 0xffffffff):
11            raise BadGzipFile("Incorrect length of data produced")
12
13        # Gzip files can be padded with zeroes and still have archives.
14        # Consume all zero bytes and set the file position to the first
15        # non-zero byte. See http://www.gzip.org/#faq8
16        c = b"\x00"
17        while c == b"\x00":
18            c = self._fp.read(1)
19        if c:
20            self._fp.prepend(c)
            

Path 3: 2 calls (0.01)

EOFError (2)

1def _read_eof(self):
2        # We've read to the end of the file
3        # We check that the computed CRC and size of the
4        # uncompressed data matches the stored values.  Note that the size
5        # stored is the true file size mod 2**32.
6        crc32, isize = struct.unpack("<II", self._read_exact(8))
7        if crc32 != self._crc:
8            raise BadGzipFile("CRC check failed %s != %s" % (hex(crc32),
9                                                             hex(self._crc)))
10        elif isize != (self._stream_size & 0xffffffff):
11            raise BadGzipFile("Incorrect length of data produced")
12
13        # Gzip files can be padded with zeroes and still have archives.
14        # Consume all zero bytes and set the file position to the first
15        # non-zero byte. See http://www.gzip.org/#faq8
16        c = b"\x00"
17        while c == b"\x00":
18            c = self._fp.read(1)
19        if c:
20            self._fp.prepend(c)