-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
HTTPResponse is missing an implementation of readinto #57673
Comments
HTTPResponse subclasses RawIOBase, but does not provide an implementation of readinto, only read. This means that it is not conforming to the IO spec, and so it cannot be wrapped in a BufferedIOBase when using the C version of io. |
This is my first contribution to a real open source project. Attached is my patch. Suggestions for improvements are welcome. |
Hello Jon, and thanks for the patch. I have a couple of comments:
Also, a nitpick: the doc entry needs a "versionadded" tag. |
Thanks for the comments. Attached is an updated patch. In the RawIOBase docs it says "If the object is in non-blocking mode and no bytes are available, None is returned." So I wasn't sure if that meant any time no bytes were available or just when no bytes are available and EOF has not been reached. -- I updated it to return 0 instead of None. I simplified _read_chunked() and renamed it to _readall_chunked() since that is all it does. I added the versionadded tag specifying that it was added in 3.3 since the patch is for the default branch. |
New changeset 806cfe39f729 by Antoine Pitrou in branch 'default': |
Ok, thank you. I've now committed the patch in the default branch. Congratulations! (since the documentation doesn't claim that HTTPResponse implements RawIOBase, I tend to consider this a feature request rather than a bugfix, hence no 3.2 commit) |
New changeset 4b21f651eeee by Antoine Pitrou in branch 'default': |
assert
from http/client.py #22737Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: