Skip to content

Commit dea91ab

Browse files
committed
Tweak read and read1 None and BlockingIOError comments
1 parent fbbc382 commit dea91ab

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

Doc/library/io.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -584,25 +584,25 @@ I/O Base Classes
584584
most streams this is to EOF, but for non-blocking streams more data may
585585
become available.
586586

587-
The standard library :class:`io.BufferedReader` returns ``None`` if the
588-
stream is non-blocking and no data is available. Other implementations may
589-
return ``None`` or raise :exc:`BlockingIOError`.
587+
.. note::
588+
589+
When the underlying raw stream is non-blocking, implementations may
590+
either raise :exc:`BlockingIOError` or return ``None`` if no data is
591+
available. :mod:`io` implementations return ``None``.
590592

591593
.. method:: read1(size=-1, /)
592594

593595
Read and return up to *size* bytes, with at most one call to the
594596
underlying raw stream's :meth:`~RawIOBase.read` (or
595-
:meth:`~RawIOBase.readinto`) method. This can be useful if you are
596-
implementing your own buffering on top of a :class:`BufferedIOBase`
597-
object.
598-
599-
If *size* is ``-1`` (the default), an arbitrary number of bytes are
600-
returned (more than zero unless EOF is reached).
597+
:meth:`~RawIOBase.readinto`) method. If *size* is ``-1`` or not provided,
598+
the implementation will decide a size to use and at most one call will be
599+
made.
601600

602601
.. note::
603602

604-
When the underlying raw stream is non-blocking, a :exc:`BlockingIOError`
605-
may be raised if a read operation cannot be completed immediately.
603+
When the underlying raw stream is non-blocking, implementations may
604+
either raise :exc:`BlockingIOError` or return ``None`` if no data is
605+
available. :mod:`io` implementations return ``None``.
606606

607607
.. method:: readinto(b, /)
608608

0 commit comments

Comments
 (0)