I have a valid zlib compressed string, attached here as 'mat.bin' (1.7M), that cause and error on zlib.decompress decompression:
>>> import zlib
>>> data = open('mat.bin', 'rb').read()
>>> out = zlib.decompress(data)
Traceback (most recent call last):
File "<ipython console>", line 1, in <module>
error: Error -5 while decompressing data
I know these data are valid, because I get the string I was expecting with:
>>> dc_obj = zlib.decompressobj()
>>> out = dc_obj.decompress(data)
As expected, there is no remaining data after this read:
>>> assert dc_obj.flush() == ''
>>>
I believe that the behavior of zlib.decompress(data) and zlib.decompressobj().decompress(data) should be equivalent, and that the error for zlib.decompress(data) is therefore the symptom of a bug. |