summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorNadeem Vawda <nadeem.vawda@gmail.com>2011-05-14 12:15:47 (GMT)
committerNadeem Vawda <nadeem.vawda@gmail.com>2011-05-14 12:15:47 (GMT)
commit5eef502de091c76d98786673dfece816572662f7 (patch)
tree2c267191a0457950b2adb9113607d8f3971e6fa7 /Lib
parent07352b084c725396bd74cef7c8204d16c4ab4a25 (diff)
parent7619e88adb27d1cd167483304cd1514812b68039 (diff)
downloadcpython-5eef502de091c76d98786673dfece816572662f7.zip
cpython-5eef502de091c76d98786673dfece816572662f7.tar.gz
cpython-5eef502de091c76d98786673dfece816572662f7.tar.bz2
Merge: #12050: zlib.decompressobj().decompress() now clears the unconsumed_tail
attribute when called without a max_length argument.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_zlib.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py
index 9aafffa..852857b 100644
--- a/Lib/test/test_zlib.py
+++ b/Lib/test/test_zlib.py
@@ -360,6 +360,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.