File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,9 @@ def all_tasks(loop=None):
35
35
"""Return a set of all tasks for the loop."""
36
36
if loop is None :
37
37
loop = events .get_running_loop ()
38
- return {t for t in _all_tasks
38
+ # NB: set(_all_tasks) is required to protect
39
+ # from https://bugs.python.org/issue34970 bug
40
+ return {t for t in list (_all_tasks )
39
41
if futures ._get_loop (t ) is loop and not t .done ()}
40
42
41
43
@@ -45,7 +47,9 @@ def _all_tasks_compat(loop=None):
45
47
# method.
46
48
if loop is None :
47
49
loop = events .get_event_loop ()
48
- return {t for t in _all_tasks if futures ._get_loop (t ) is loop }
50
+ # NB: set(_all_tasks) is required to protect
51
+ # from https://bugs.python.org/issue34970 bug
52
+ return {t for t in list (_all_tasks ) if futures ._get_loop (t ) is loop }
49
53
50
54
51
55
class Task (futures ._PyFuture ): # Inherit Python Task implementation
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