Skip to content

Commit

Permalink
Fix #3497: Ignore done tasks when cancels pending activities on web.r…
Browse files Browse the repository at this point in the history
…un_app finalization.
  • Loading branch information
asvetlov committed Jan 8, 2019
1 parent b42a23b commit 67858a9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions aiohttp/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,15 @@
from typing_extensions import ContextManager


all_tasks = asyncio.Task.all_tasks
def all_tasks(
loop: Optional[asyncio.AbstractEventLoop] = None
) -> Set['asyncio.Task[Any]']:
tasks = list(asyncio.Task.all_tasks(loop)) # type: ignore
return {t for t in tasks if not t.done()}


if PY_37:
all_tasks = getattr(asyncio, 'all_tasks') # use the trick to cheat mypy
all_tasks = getattr(asyncio, 'all_tasks') # noqa


_T = TypeVar('_T')
Expand Down

0 comments on commit 67858a9

Please sign in to comment.