From 7619e88adb27d1cd167483304cd1514812b68039 Mon Sep 17 00:00:00 2001 From: Nadeem Vawda Date: Sat, 14 May 2011 14:05:20 +0200 Subject: Issue #12050: zlib.decompressobj().decompress() now clears the unconsumed_tail attribute when called without a max_length argument. --- Lib/test/test_zlib.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Lib/test/test_zlib.py') diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py index 7593c064b0..f99190031c 100644 --- a/Lib/test/test_zlib.py +++ b/Lib/test/test_zlib.py @@ -350,6 +350,15 @@ class CompressObjectTestCase(BaseCompressTestCase, unittest.TestCase): self.assertRaises(ValueError, dco.decompress, b"", -1) self.assertEqual(b'', dco.unconsumed_tail) + def test_clear_unconsumed_tail(self): + # Issue #12050: calling decompress() without providing max_length + # should clear the unconsumed_tail attribute. + cdata = b"x\x9cKLJ\x06\x00\x02M\x01" # "abc" + dco = zlib.decompressobj() + ddata = dco.decompress(cdata, 1) + ddata += dco.decompress(dco.unconsumed_tail) + self.assertEqual(dco.unconsumed_tail, b"") + def test_flushes(self): # Test flush() with the various options, using all the # different levels in order to provide more variations. -- cgit v1.2.1