Skip to content
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

Missing yield from aiohttp/client.py #316

Closed
jennolsen84 opened this issue Apr 7, 2015 · 7 comments
Closed

Missing yield from aiohttp/client.py #316

jennolsen84 opened this issue Apr 7, 2015 · 7 comments
Labels

Comments

@jennolsen84
Copy link

Is there supposed to be a yield from in the following statement (request.write)?

https://github.com/KeepSafe/aiohttp/blob/master/aiohttp/client.py#L510

or the latest release (in case master moves)

https://github.com/KeepSafe/aiohttp/blob/v0.15.1/aiohttp/client.py#L517

@fafhrd91
Copy link
Member

fafhrd91 commented Apr 7, 2015

request.write() is not really coroutine.

https://github.com/KeepSafe/aiohttp/blob/master/aiohttp/protocol.py#L654

@fafhrd91 fafhrd91 closed this as completed Apr 7, 2015
@jennolsen84
Copy link
Author

Seems like it returns a coroutine though

https://github.com/KeepSafe/aiohttp/blob/master/aiohttp/protocol.py#L685

@fafhrd91
Copy link
Member

fafhrd91 commented Apr 7, 2015

thats fine if we now that we do not want to drain transport buffer. in any case not using yield from is a conscious decision. and as i understand that is what is your question.

@jennolsen84
Copy link
Author

OK, I see... perhaps a keyword arg can be introduced to avoid returning a coroutine in that situation.

The reason I say that is because I get a bunch of warnings when I turn on asyncio debugging (using the following), and it can easily make other legitimate warnings hard to find

PYTHONASYNCIODEBUG=1
<CoroWrapper StreamWriter.drain() running at /usr/lib/python3.4/asyncio/streams.py:286, created at /root/pyenvs/my_env/lib/python3.4/site-packages/aiohttp/protocol.py:685> was never yielded from
Coroutine object created at (most recent call last):
  File "/srv/compute/start_server.py", line 8, in <module>
    s.loop.run_forever()
  File "/usr/lib/python3.4/asyncio/base_events.py", line 244, in run_forever
    self._run_once()
  File "/usr/lib/python3.4/asyncio/base_events.py", line 1075, in _run_once
    handle._run()
  File "/usr/lib/python3.4/asyncio/events.py", line 120, in _run
    self._callback(*self._args)
  File "/usr/lib/python3.4/asyncio/tasks.py", line 237, in _step
    result = next(coro)
  File "/usr/lib/python3.4/asyncio/coroutines.py", line 79, in __next__
    return next(self.gen)
  File "/root/pyenvs/my_env/lib/python3.4/site-packages/aiohttp/client.py", line 517, in write_bytes
    request.write(chunk)
  File "/root/pyenvs/my_env/lib/python3.4/site-packages/aiohttp/protocol.py", line 685, in write
    return self.transport.drain()

@fafhrd91
Copy link
Member

fafhrd91 commented Apr 7, 2015

oh!

@fafhrd91 fafhrd91 reopened this Apr 7, 2015
fafhrd91 added a commit that referenced this issue Apr 8, 2015
@fafhrd91
Copy link
Member

fafhrd91 commented Apr 8, 2015

fixed

@fafhrd91 fafhrd91 closed this as completed Apr 8, 2015
@lock
Copy link

lock bot commented Oct 29, 2019

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

@lock lock bot added the outdated label Oct 29, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants