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 <report@bugs.python.org> <http://bugs.python.org/issue22671> _______________________________________
Changes by Ezio Melotti <ezio.melotti@gmail.com>: ---------- keywords: +easy nosy: +pitrou stage: -> needs patch versions: +Python 3.5 -Python 3.3 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue22671> _______________________________________
Changes by Chandan kumar <chkumar246@gmail.com>: ---------- nosy: +Chandan.kumar _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue22671> _______________________________________
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 <report@bugs.python.org> <http://bugs.python.org/issue22671> _______________________________________
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 <report@bugs.python.org> <http://bugs.python.org/issue22671> _______________________________________
Changes by Berker Peksag <berker.peksag@gmail.com>: ---------- nosy: +berker.peksag stage: needs patch -> patch review _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue22671> _______________________________________
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 <report@bugs.python.org> <http://bugs.python.org/issue22671> _______________________________________
Serhiy Storchaka <storchaka+cpython@gmail.com> added the comment: Do you mind to create a PR Martin? ---------- assignee: docs@python -> martin.panter nosy: +serhiy.storchaka versions: +Python 3.6, Python 3.7 -Python 3.4, Python 3.5 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue22671> _______________________________________
Martin Panter <vadmium+py@gmail.com> added the comment: I’m unlikely to soon, but I don’t mind if someone else uses my patch. ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue22671> _______________________________________
Change by Sanyam Khurana <sanyam.khurana01@gmail.com>: ---------- pull_requests: +4496 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue22671> _______________________________________
STINNER Victor <victor.stinner@gmail.com> added the comment: 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/1b74f9b77a6fa1d7828986cb79d5b10942f... ---------- nosy: +vstinner _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue22671> _______________________________________
Change by Roundup Robot <devnull@psf.upfronthosting.co.za>: ---------- pull_requests: +4695 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue22671> _______________________________________
STINNER Victor <victor.stinner@gmail.com> added the comment: 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/0aa2a1d003b476b954ecdcb7e966bf7f0b7... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue22671> _______________________________________
STINNER Victor <victor.stinner@gmail.com> added the comment: Thank you Martin Panter and Sanyam Khurana for the fix. ---------- resolution: -> fixed stage: patch review -> resolved status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue22671> _______________________________________
Change by Sanyam Khurana <sanyam.khurana01@gmail.com>: ---------- pull_requests: +4708 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue22671> _______________________________________
participants (9)
-
Berker Peksag
-
Chandan kumar
-
Ezio Melotti
-
gigaplastik
-
Martin Panter
-
Roundup Robot
-
Sanyam Khurana
-
Serhiy Storchaka
-
STINNER Victor