Skip to content

_CoroGuard cannot be awaited #2026

Closed
Closed
@litwisha

Description

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

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions