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

_CoroGuard cannot be awaited #2026

Closed
litwisha opened this issue Jun 27, 2017 · 4 comments
Closed

_CoroGuard cannot be awaited #2026

litwisha opened this issue Jun 27, 2017 · 4 comments
Labels

Comments

@litwisha
Copy link
Contributor

litwisha commented Jun 27, 2017

Long story short

  1. _CoroGuard class has no implementation for __await__ method, only __iter__.
    That's why_CoroGuard instance cannot be awaited, just yielded from.

  2. Fix warning message for ClientSession.close() method

Expected behaviour

  • _CoroGuard can be awaited

Actual behaviour

  • _CoroGuard cannot be awaited

Steps to reproduce

#!/usr/bin/env python
import aiohttp
import asyncio


async def coro_function(loop):
    session = aiohttp.ClientSession(loop=loop)
    await session.close()


if __name__ == '__main__':
    loop = asyncio.get_event_loop()
    try:
        loop.run_until_complete(coro_function(loop))
    finally:
        loop.close()

Your environment

OS X 10.12.3
python 3.6.0
aiohttp==2.2.0
@hellysmile
Copy link
Member

Why it should produce warning if not awaited/yield from? Seems starting aiohttp 2.0+ close is synchronous method, previously it was returning empty future.

@asvetlov
Copy link
Member

@hellysmile

It's still asynchronous but I want to stress people and force them to use await session.close() during migration period.

The method still returns empty future but will be replaced with pure coroutine eventually.

@asvetlov
Copy link
Member

Closed by #2027

@lock
Copy link

lock bot commented Oct 28, 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 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 28, 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

3 participants