New submission from Evgeny Kapun:
>From the documentation for GzipFile.peek():
At most one single read on the compressed stream is done to satisfy the
If "compressed stream" means the underlying file object, then this is not true.
The method tries to return at least one byte, unless the stream is at EOF. It
is possible to create arbitrarily long compressed stream that would decompress
to nothing, and the implementation would read the entire stream in this case.
Because the length of the stream is not known in advance, several reads may be
required for this.
Perhaps the documentation for GzipFile.peek() should be made the same as that
for BZ2File.peek() and LZMAFile.peek().
nosy: abacabadabacaba, docs@python
title: Wrong documentation for GzipFile.peek
versions: Python 3.5
Python tracker <rep...@bugs.python.org>
Python-bugs-list mailing list