[Python-checkins] r81095 - in python/branches/release26-maint: Lib/test/test_zlib.py Misc/NEWS

antoine.pitrou python-checkins at python.org
Wed May 12 01:33:53 CEST 2010


Author: antoine.pitrou
Date: Wed May 12 01:33:53 2010
New Revision: 81095

Log:
Merged revisions 81094 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81094 | antoine.pitrou | 2010-05-12 01:32:31 +0200 (mer., 12 mai 2010) | 6 lines
  
  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).
........


Modified:
   python/branches/release26-maint/   (props changed)
   python/branches/release26-maint/Lib/test/test_zlib.py
   python/branches/release26-maint/Misc/NEWS

Modified: python/branches/release26-maint/Lib/test/test_zlib.py
==============================================================================
--- python/branches/release26-maint/Lib/test/test_zlib.py	(original)
+++ python/branches/release26-maint/Lib/test/test_zlib.py	Wed May 12 01:33:53 2010
@@ -360,6 +360,19 @@
         dco = zlib.decompressobj()
         self.assertEqual(dco.flush(), "") # Returns nothing
 
+    def test_decompress_incomplete_stream(self):
+        # This is 'foo', deflated
+        x = 'x\x9cK\xcb\xcf\x07\x00\x02\x82\x01E'
+        # For the record
+        self.assertEqual(zlib.decompress(x), '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, 'foo')
+
     if hasattr(zlib.compressobj(), "copy"):
         def test_compresscopy(self):
             # Test copying a compression object

Modified: python/branches/release26-maint/Misc/NEWS
==============================================================================
--- python/branches/release26-maint/Misc/NEWS	(original)
+++ python/branches/release26-maint/Misc/NEWS	Wed May 12 01:33:53 2010
@@ -186,6 +186,10 @@
 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.
 


More information about the Python-checkins mailing list