diff options
-rw-r--r-- | Lib/test/test_zlib.py | 13 | ||||
-rw-r--r-- | Misc/NEWS | 4 |
2 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py index 3a5bd30..0c259cc 100644 --- a/Lib/test/test_zlib.py +++ b/Lib/test/test_zlib.py @@ -379,6 +379,19 @@ class CompressObjectTestCase(BaseCompressTestCase, unittest.TestCase): dco = zlib.decompressobj() self.assertEqual(dco.flush(), b"") # Returns nothing + def test_decompress_incomplete_stream(self): + # This is 'foo', deflated + x = b'x\x9cK\xcb\xcf\x07\x00\x02\x82\x01E' + # For the record + self.assertEqual(zlib.decompress(x), b'foo') + self.assertRaises(zlib.error, zlib.decompress, x[:-5]) + # Omitting the stream end works with decompressor objects + # (see issue #8672). + dco = zlib.decompressobj() + y = dco.decompress(x[:-5]) + y += dco.flush() + self.assertEqual(y, b'foo') + if hasattr(zlib.compressobj(), "copy"): def test_compresscopy(self): # Test copying a compression object @@ -176,6 +176,10 @@ Build Tests ----- +- Issue #8672: Add a zlib test ensuring that an incomplete stream can be + handled by a decompressor object without errors (it returns incomplete + uncompressed data). + - Issue #8629: Disable some test_ssl tests, since they give different results with OpenSSL 1.0.0 and higher. |