-
-
Notifications
You must be signed in to change notification settings - Fork 34.5k
gh-100226: Clarify StreamReader.read behavior #101807
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
cce42af
970b725
d5f28eb
976c25e
a920fbe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -206,12 +206,21 @@ StreamReader | |
|
|
||
| .. coroutinemethod:: read(n=-1) | ||
|
|
||
| Read up to *n* bytes. If *n* is not provided, or set to ``-1``, | ||
| read until EOF and return all read bytes. | ||
| Read up to *n* bytes from the stream. | ||
|
|
||
| If *n* is not provided, or set to ``-1``, | ||
| read until EOF, then return all read :class:`bytes`. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As a beginning reader, before having read @jgosmann 's detailed explaination and @gvanrossum 's summary, I was evidently confused here about what "until EOF" specifically meant in this context. It therefore might warrant some more clarity here, but maybe its just my lack of subject matter expertise compared with the target audience. |
||
| If EOF was received and the internal buffer is empty, | ||
| return an empty ``bytes`` object. | ||
|
|
||
| If *n* is ``0``, return an empty ``bytes`` object immediately. | ||
|
|
||
| If *n* is positive, wait for at least 1 byte to become available | ||
| (or EOF), then return the available ``bytes`` which might be less | ||
| than *n*. | ||
|
CAM-Gerlach marked this conversation as resolved.
Outdated
jgosmann marked this conversation as resolved.
Outdated
|
||
| If EOF is received before any byte is read, return an empty | ||
| ``bytes`` object. | ||
|
|
||
| .. coroutinemethod:: readline() | ||
|
|
||
| Read one line, where "line" is a sequence of bytes | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.