zlib.decompress fails, zlib.decompressobj succeeds - bug or feature?

Antoine Pitrou solipsis at pitrou.net
Sun May 9 08:57:50 EDT 2010


On Sun, 9 May 2010 01:28:14 -0700 (PDT)
Matthew Brett <matthew.brett at gmail.com> wrote:
> 
> If instead I do this:
> 
> out = zlib.decompressobj().decompress(data)

How about:

d = zlib.decompressobj()
out = d.decompress(data) + d.flush()

?

Notice the documentation for decompressobj.decompress (emphasis mine):

“Decompress string, returning a string containing the uncompressed data
corresponding to *at least part* of the data in string”.





More information about the Python-list mailing list