Message176883
| Author |
serhiy.storchaka |
| Recipients |
Arfrever, christian.heimes, eric.araujo, nadeem.vawda, pitrou, serhiy.storchaka |
| Date |
2012年12月04日.08:49:43 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<201212041049.23400.storchaka@gmail.com> |
| In-reply-to |
<1354485169.64.0.67284748913.issue15955@psf.upfronthosting.co.za> |
| Content |
> # Using zlib's interface
> while not d.eof:
> compressed = d.unconsumed_tail or f.read(8192)
> if not compressed:
> raise ValueError('End-of-stream marker not found')
> output = d.decompress(compressed, 8192)
> # <process output>
This is not usable with bzip2. Bzip2 uses large block size and unconsumed_tail
can be non empty but decompress() will return b''. With zlib you possible can
see the same effect on some input when read by one byte.
> A related, but orthogonal proposal: We might want to make unconsumed_tail
> a memoryview (provided the input data is know to be immutable), to avoid
> creating an unnecessary copy of the data.
It looks interesting. However the data should be copied anyway if the input
data is not a bytes object. |
|