> What if unconsumed_tail is not empty but less than needed to decompress at
> least one byte? We need read more data until unconsumed_tail grow enought to
> be decompressed.
This is possible in zlib, but not in bz2. According to the manual [1], it is
perfectly OK to supply one byte at a time.
For xz, I'm not sure whether this problem could occur. I had assumed that it
could not, but I may be mistaken ;-). Unfortunately liblzma has no proper
manual, so I'll have to dig into the implementation to find out, and I haven't
had the time to do this yet.
[As an aside, it would be nice if the documentation for the zlib module
mentioned this problem. We can't assume that users of the Python module are
familiar with the C API for zlib...]
[1] http://www.bzip.org/1.0.5/bzip2-manual-1.0.5.html |