File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,7 +42,9 @@ def all_tasks(loop=None):
4242 """Return a set of all tasks for the loop."""
4343 if loop is None :
4444 loop = events .get_running_loop ()
45- return {t for t in _all_tasks
45+ # NB: set(_all_tasks) is required to protect
46+ # from https://bugs.python.org/issue34970 bug
47+ return {t for t in list (_all_tasks )
4648 if futures ._get_loop (t ) is loop and not t .done ()}
4749
4850
@@ -52,7 +54,9 @@ def _all_tasks_compat(loop=None):
5254 # method.
5355 if loop is None :
5456 loop = events .get_event_loop ()
55- return {t for t in _all_tasks if futures ._get_loop (t ) is loop }
57+ # NB: set(_all_tasks) is required to protect
58+ # from https://bugs.python.org/issue34970 bug
59+ return {t for t in list (_all_tasks ) if futures ._get_loop (t ) is loop }
5660
5761
5862def _set_task_name (task , name ):
Original file line number Diff line number Diff line change 1+ Protect tasks weak set manipulation in ``asyncio.all_tasks() ``
You can’t perform that action at this time.
0 commit comments