msg229677 - (view) |
Author: gigaplastik (gigaplastik) * |
Date: 2014-10-19 09:35 |
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. |
|
|
msg232970 - (view) |
Author: Martin Panter (martin.panter) *  |
Date: 2014-12-20 12:30 |
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. |
|
|
msg233029 - (view) |
Author: Martin Panter (martin.panter) *  |
Date: 2014-12-22 23:31 |
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) |
|
|
msg239863 - (view) |
Author: Martin Panter (martin.panter) *  |
Date: 2015-04-02 00:05 |
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 |
|
|
msg305159 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2017-10-28 12:09 |
Do you mind to create a PR Martin? |
|
|
msg305172 - (view) |
Author: Martin Panter (martin.panter) *  |
Date: 2017-10-29 03:06 |
I’m unlikely to soon, but I don’t mind if someone else uses my patch. |
|
|
msg308042 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2017-12-11 13:42 |
New changeset 1b74f9b77a6fa1d7828986cb79d5b10942ff9141 by Victor Stinner (Sanyam Khurana) in branch 'master': bpo-22671: Clarify and test default read method implementations (#4568) https://github.com/python/cpython/commit/1b74f9b77a6fa1d7828986cb79d5b10942ff9141 |
|
|
msg308044 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2017-12-11 14:27 |
New changeset 0aa2a1d003b476b954ecdcb7e966bf7f0b75a06b by Victor Stinner (Miss Islington (bot)) in branch '3.6': bpo-22671: Clarify and test default read method implementations (GH-4568) (#4796) https://github.com/python/cpython/commit/0aa2a1d003b476b954ecdcb7e966bf7f0b75a06b |
|
|
msg308045 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2017-12-11 14:28 |
Thank you Martin Panter and Sanyam Khurana for the fix. |
|
|