mirror of
https://github.com/python/cpython.git
synced 2025-11-24 20:30:18 +00:00
Issue #21560: An attempt to write a data of wrong type no longer cause
GzipFile corruption. Original patch by Wolfgang Maier.
This commit is contained in:
parent
f6e31b79a8
commit
d4c2ac8394
3 changed files with 38 additions and 2 deletions
|
|
@ -339,9 +339,9 @@ class GzipFile(io.BufferedIOBase):
|
|||
data = data.tobytes()
|
||||
|
||||
if len(data) > 0:
|
||||
self.size = self.size + len(data)
|
||||
self.fileobj.write(self.compress.compress(data))
|
||||
self.size += len(data)
|
||||
self.crc = zlib.crc32(data, self.crc) & 0xffffffff
|
||||
self.fileobj.write( self.compress.compress(data) )
|
||||
self.offset += len(data)
|
||||
|
||||
return len(data)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue