-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
StreamReader.iter_chunks() raises IndexError #2112
Labels
Comments
jlacoline
added a commit
to jlacoline/aiohttp
that referenced
this issue
Jul 19, 2017
5 tasks
Fixed by pr |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Long story short
Any generator given by the
iter_chunks()
method onStreamReader
will end raising anIndexError
.This comes from the
readchunk()
method which fails ifthe buffer is emptythe end of file is reached.Expected behaviour
stream.readchunk()
should returnb""
ifthe buffer is emptyeof is reachedstream.iter_chunks()
should return a generator that yields all the chunks and then raiseStopAsyncIteration
Actual behaviour
stream.readchunk()
raisesIndexError
ifthe buffer is emptyeof is reachedstream.iter_chunks()
returns a generator that yields all the chunks and then raisesIndexError
Steps to reproduce
For
stream.readchunk()
: In the associated unit test in tests/test_streams.py, replacestream.read()
withstream.readchunk()
Result:
Your environment
The text was updated successfully, but these errors were encountered: