MCPcopy Index your code
hub / github.com/python/cpython / _update_crc

Method _update_crc

Lib/zipfile/__init__.py:1107–1115  ·  view source on GitHub ↗
(self, newdata)

Source from the content-addressed store, hash-verified

1105 return buf
1106
1107 def _update_crc(self, newdata):
1108 # Update the CRC using the given data.
1109 if self._expected_crc is None:
1110 # No need to compute the CRC if we don't have a reference value
1111 return
1112 self._running_crc = crc32(newdata, self._running_crc)
1113 # Check the CRC if we're at the end of the file
1114 if self._eof and self._running_crc != self._expected_crc:
1115 raise BadZipFile("Bad CRC-32 for file %r" % self.name)
1116
1117 def read1(self, n):
1118 """Read up to n bytes with at most one read() system call."""

Callers 1

_read1Method · 0.95

Calls 2

crc32Function · 0.85
BadZipFileClass · 0.85

Tested by

no test coverage detected