[New-bugs-announce] [issue28445] Wrong documentation for GzipFile.peek

Evgeny Kapun report at bugs.python.org
Fri Oct 14 12:53:42 EDT 2016


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 call.

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().

----------
assignee: docs at python
components: Documentation
messages: 278656
nosy: abacabadabacaba, docs at python
priority: normal
severity: normal
status: open
title: Wrong documentation for GzipFile.peek
versions: Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28445>
_______________________________________


More information about the New-bugs-announce mailing list