Message135697
http://docs.python.org/library/zlib.html
says
"If max_length is not supplied then the whole input is decompressed, and unconsumed_tail is an empty string."
However, if there's preceding decompress call with max_length specified, unconsumed_tail will not be empty.
----
import zlib
c = zlib.compressobj(zlib.Z_DEFAULT_COMPRESSION, zlib.DEFLATED, -zlib.MAX_WBITS)
compressed = c.compress('abc')
compressed += c.flush(zlib.Z_SYNC_FLUSH)
d = zlib.decompressobj(-zlib.MAX_WBITS)
original = d.decompress(data, 1)
original += d.decompress(d.unconsumed_tail)
print "%r" % d.unconsumed_tail
----
Result is
----
'\x06\x00\x00\x00\xff\xff'
----
Document or code should be fixed. |
|
Date |
User |
Action |
Args |
2011-05-10 10:44:15 | Takeshi.Yoshino | set | recipients:
+ Takeshi.Yoshino |
2011-05-10 10:44:14 | Takeshi.Yoshino | set | messageid: <1305024254.99.0.898091507318.issue12050@psf.upfronthosting.co.za> |
2011-05-10 10:44:13 | Takeshi.Yoshino | link | issue12050 messages |
2011-05-10 10:44:13 | Takeshi.Yoshino | create | |
|