New submission from gigaplastik:
The online documentation for class io.BufferedIOBase states the following:
"Besides, the read() method does not have a default implementation that defers to readinto()."
According to the documentation for class io.RawIOBase (which the statement compares with) read() method actually defers to readall(), NOT readinto() as misleadingly stated.
The same typo is present in help('io.BufferedIOBase') output and, very likely, in all 3.X line docs for this class.
----------
assignee: docs@python
components: Documentation
messages: 229677
nosy: docs@python, gigaplastik
priority: normal
severity: normal
status: open
title: Typo in class io.BufferedIOBase docs
type: enhancement
versions: Python 3.3, Python 3.4
_______________________________________
Python tracker
Changes by Ezio Melotti
Changes by Chandan kumar
Martin Panter added the comment:
The documentation was technically correct but too scanty. RawIOBase.read(-1) does defer to readall(), but with a proper size passed, it defers to readinto() instead. Here is a patch which hopefully clarifies this, and also explains which methods have a usable default implementation. Includes some tests for RawIOBase and BufferedIOBase which didn’t seem to be there already.
----------
keywords: +patch
nosy: +vadmium
Added file: http://bugs.python.org/file37515/read-defaults.patch
_______________________________________
Python tracker
Martin Panter added the comment:
Adding patch v2 with readinto1() as a “mixin method” and dropped many of my earlier changes for better consistency with the introduction of the classes (which I never really read before :P)
----------
Added file: http://bugs.python.org/file37528/read-defaults.v2.patch
_______________________________________
Python tracker
Changes by Berker Peksag
Martin Panter added the comment:
read-defaults.v3.patch:
* Split off test_RawIOBase_readall()
* Changed BufferedIOBase tests to matrix of tuples
* Added tests for empty buffer
* Test that unused part of buffer remains untouched
----------
Added file: http://bugs.python.org/file38798/read-defaults.v3.patch
_______________________________________
Python tracker
Serhiy Storchaka
Martin Panter
Change by Sanyam Khurana
STINNER Victor
Change by Roundup Robot
STINNER Victor
STINNER Victor
Change by Sanyam Khurana
participants (9)
-
Berker Peksag
-
Chandan kumar
-
Ezio Melotti
-
gigaplastik
-
Martin Panter
-
Roundup Robot
-
Sanyam Khurana
-
Serhiy Storchaka
-
STINNER Victor