We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 396ec1f commit 22e9723Copy full SHA for 22e9723
CHANGES/3497.bugfix
@@ -0,0 +1 @@
1
+Ignore done tasks when cancels pending activities on ``web.run_app`` finalization.
aiohttp/helpers.py
@@ -63,10 +63,15 @@
63
from typing_extensions import ContextManager
64
65
66
-all_tasks = asyncio.Task.all_tasks
+def all_tasks(
67
+ loop: Optional[asyncio.AbstractEventLoop] = None
68
+) -> Set['asyncio.Task[Any]']:
69
+ tasks = list(asyncio.Task.all_tasks(loop)) # type: ignore
70
+ return {t for t in tasks if not t.done()}
71
+
72
73
if PY_37:
- all_tasks = getattr(asyncio, 'all_tasks') # use the trick to cheat mypy
74
+ all_tasks = getattr(asyncio, 'all_tasks') # noqa
75
76
77
_T = TypeVar('_T')
0 commit comments