summaryrefslogtreecommitdiffstats
path: root/Lib/gzip.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2009-12-14 18:00:06 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2009-12-14 18:00:06 (GMT)
commit77b338be20f29712c0774e7c2d36d7afb541e4b6 (patch)
tree071314bbc64d33e1cb3284764a1c7f2f13423bea /Lib/gzip.py
parent338eae3460be044e1af9c590dff1a15baaa0520a (diff)
downloadcpython-77b338be20f29712c0774e7c2d36d7afb541e4b6.zip
cpython-77b338be20f29712c0774e7c2d36d7afb541e4b6.tar.gz
cpython-77b338be20f29712c0774e7c2d36d7afb541e4b6.tar.bz2
Issue #4757: `zlib.compress` and other methods in the zlib module now
raise a TypeError when given an `str` object (rather than a `bytes`-like object). Patch by Victor Stinner and Florent Xicluna.
Diffstat (limited to 'Lib/gzip.py')
-rw-r--r--Lib/gzip.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/gzip.py b/Lib/gzip.py
index 08f9da5..f9a59d7 100644
--- a/Lib/gzip.py
+++ b/Lib/gzip.py
@@ -147,7 +147,7 @@ class GzipFile:
def _init_write(self, filename):
self.name = filename
- self.crc = zlib.crc32("") & 0xffffffff
+ self.crc = zlib.crc32(b"") & 0xffffffff
self.size = 0
self.writebuf = []
self.bufsize = 0
@@ -178,7 +178,7 @@ class GzipFile:
self.fileobj.write(fname + b'\000')
def _init_read(self):
- self.crc = zlib.crc32("") & 0xffffffff
+ self.crc = zlib.crc32(b"") & 0xffffffff
self.size = 0
def _read_gzip_header(self):