Fixes release blocker issue #3492 and #3790.
Make zlib and zipimport to return bytes instead of bytearray and use bytes
rather than bytearray for their internal leftover data storages.
diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py
index b5f3fe5..f52aa5e 100644
--- a/Lib/test/test_zlib.py
+++ b/Lib/test/test_zlib.py
@@ -110,6 +110,8 @@
y1 = dco.decompress(x1 + x2)
y2 = dco.flush()
self.assertEqual(data, y1 + y2)
+ self.assert_(isinstance(dco.unconsumed_tail, bytes))
+ self.assert_(isinstance(dco.unused_data, bytes))
def test_compressoptions(self):
# specify lots of options to compressobj()
@@ -152,7 +154,11 @@
bufs.append(co.flush())
combuf = b''.join(bufs)
- self.assertEqual(data, zlib.decompress(combuf))
+ decombuf = zlib.decompress(combuf)
+ # Test type of return value
+ self.assert_(isinstance(decombuf, bytes))
+
+ self.assertEqual(data, decombuf)
dco = zlib.decompressobj()
bufs = []
@@ -348,6 +354,8 @@
# Test copying a decompression object
data = HAMLET_SCENE
comp = zlib.compress(data)
+ # Test type of return value
+ self.assert_(isinstance(comp, bytes))
d0 = zlib.decompressobj()
bufs0 = []