Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Address docstring review
  • Loading branch information
erlend-aasland committed May 10, 2023
commit 940db40899e984a67c8abb05d83aaaee684a0b13
6 changes: 3 additions & 3 deletions Modules/_io/bufferedio.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ _io._BufferedIOBase.read
Read and return up to n bytes.

If the argument is omitted, None, or negative, read and
return all data until EOF
return all data until EOF.

If the argument is positive, and the underlying raw stream is
not 'interactive', multiple raw reads may be issued to satisfy
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to clarify what "interactive" means. I suppose that it's related to "is it a TTY?" test.

The doc uses the same phrasing: https://docs.python.org/dev/library/io.html#io.BufferedIOBase.read

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. Let's improve that in a separate issue/PR. Good observation, though!

the byte count (unless EOF is reached first).
But for interactive raw streams (as well as sockets and pipes),
However, for interactive raw streams (as well as sockets and pipes),
at most one raw read will be issued, and a short result does not
imply that EOF is imminent.

Expand All @@ -160,7 +160,7 @@ mode and no data is available at the moment.
static PyObject *
_io__BufferedIOBase_read_impl(PyObject *self, PyTypeObject *cls,
PyObject *args)
/*[clinic end generated code: output=4521b30940fd7b67 input=83f4490585256485]*/
/*[clinic end generated code: output=4521b30940fd7b67 input=390205758adc8510]*/
{
_PyIO_State *state = IO_STATE();
return bufferediobase_unsupported(state, "read");
Expand Down
6 changes: 3 additions & 3 deletions Modules/_io/clinic/bufferedio.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.