summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
authorSanyam Khurana <8039608+CuriousLearner@users.noreply.github.com>2017-12-11 13:42:09 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2017-12-11 13:42:09 (GMT)
commit1b74f9b77a6fa1d7828986cb79d5b10942ff9141 (patch)
tree8c1f1d7b3e5b2a0a128868fa7e78c4b688c02ea9 /Doc/library
parent48d4dd974f0c8d47c54990eedd322b96b19c60ec (diff)
downloadcpython-1b74f9b77a6fa1d7828986cb79d5b10942ff9141.zip
cpython-1b74f9b77a6fa1d7828986cb79d5b10942ff9141.tar.gz
cpython-1b74f9b77a6fa1d7828986cb79d5b10942ff9141.tar.bz2
bpo-22671: Clarify and test default read method implementations (#4568)
Original patch written by Martin Panter, enhanced by Sanyam Khurana.
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/io.rst13
1 files changed, 8 insertions, 5 deletions
diff --git a/Doc/library/io.rst b/Doc/library/io.rst
index 8a695ad..6778058 100644
--- a/Doc/library/io.rst
+++ b/Doc/library/io.rst
@@ -205,8 +205,8 @@ ABC Inherits Stub Methods Mixin M
``writable``, and ``writelines``
:class:`RawIOBase` :class:`IOBase` ``readinto`` and Inherited :class:`IOBase` methods, ``read``,
``write`` and ``readall``
-:class:`BufferedIOBase` :class:`IOBase` ``detach``, ``read``, Inherited :class:`IOBase` methods, ``readinto``
- ``read1``, and ``write``
+:class:`BufferedIOBase` :class:`IOBase` ``detach``, ``read``, Inherited :class:`IOBase` methods, ``readinto``,
+ ``read1``, and ``write`` and ``readinto1``
:class:`TextIOBase` :class:`IOBase` ``detach``, ``read``, Inherited :class:`IOBase` methods, ``encoding``,
``readline``, and ``errors``, and ``newlines``
``write``
@@ -385,14 +385,17 @@ I/O Base Classes
.. method:: read(size=-1)
Read up to *size* bytes from the object and return them. As a convenience,
- if *size* is unspecified or -1, :meth:`readall` is called. Otherwise,
- only one system call is ever made. Fewer than *size* bytes may be
- returned if the operating system call returns fewer than *size* bytes.
+ if *size* is unspecified or -1, all bytes until EOF are returned.
+ Otherwise, only one system call is ever made. Fewer than *size* bytes may
+ be returned if the operating system call returns fewer than *size* bytes.
If 0 bytes are returned, and *size* was not 0, this indicates end of file.
If the object is in non-blocking mode and no bytes are available,
``None`` is returned.
+ The default implementation defers to :meth:`readall` and
+ :meth:`readinto`.
+
.. method:: readall()
Read and return all the bytes from the stream until EOF, using multiple