|
|
|
@ -513,6 +513,18 @@ class CompressObjectTestCase(BaseCompressTestCase, unittest.TestCase): |
|
|
|
self.assertEqual(dco.unconsumed_tail, b'') |
|
|
|
self.assertEqual(dco.unused_data, remainder) |
|
|
|
|
|
|
|
def test_flush_with_freed_input(self): |
|
|
|
# Issue #16411: decompressor accesses input to last decompress() call |
|
|
|
# in flush(), even if this object has been freed in the meanwhile. |
|
|
|
input1 = b'abcdefghijklmnopqrstuvwxyz' |
|
|
|
input2 = b'QWERTYUIOPASDFGHJKLZXCVBNM' |
|
|
|
data = zlib.compress(input1) |
|
|
|
dco = zlib.decompressobj() |
|
|
|
dco.decompress(data, 1) |
|
|
|
del data |
|
|
|
data = zlib.compress(input2) |
|
|
|
self.assertEqual(dco.flush(), input1[1:]) |
|
|
|
|
|
|
|
if hasattr(zlib.compressobj(), "copy"): |
|
|
|
def test_compresscopy(self): |
|
|
|
# Test copying a compression object |
|
|
|
|