Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
97cf0828
Commit
97cf0828
authored
Oct 13, 2018
by
Andrew Svetlov
Committed by
Miss Islington (bot)
Oct 13, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-34970: Protect tasks weak set manipulation in asyncio.all_tasks() (GH-9837)
https://bugs.python.org/issue34970
parent
1a997eb2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
2 deletions
+7
-2
Lib/asyncio/tasks.py
Lib/asyncio/tasks.py
+6
-2
Misc/NEWS.d/next/Library/2018-10-13-11-14-13.bpo-34970.SrJTY7.rst
...S.d/next/Library/2018-10-13-11-14-13.bpo-34970.SrJTY7.rst
+1
-0
No files found.
Lib/asyncio/tasks.py
View file @
97cf0828
...
...
@@ -42,7 +42,9 @@ def all_tasks(loop=None):
"""Return a set of all tasks for the loop."""
if
loop
is
None
:
loop
=
events
.
get_running_loop
()
return
{
t
for
t
in
_all_tasks
# NB: set(_all_tasks) is required to protect
# from https://bugs.python.org/issue34970 bug
return
{
t
for
t
in
list
(
_all_tasks
)
if
futures
.
_get_loop
(
t
)
is
loop
and
not
t
.
done
()}
...
...
@@ -52,7 +54,9 @@ def _all_tasks_compat(loop=None):
# method.
if
loop
is
None
:
loop
=
events
.
get_event_loop
()
return
{
t
for
t
in
_all_tasks
if
futures
.
_get_loop
(
t
)
is
loop
}
# NB: set(_all_tasks) is required to protect
# from https://bugs.python.org/issue34970 bug
return
{
t
for
t
in
list
(
_all_tasks
)
if
futures
.
_get_loop
(
t
)
is
loop
}
def
_set_task_name
(
task
,
name
):
...
...
Misc/NEWS.d/next/Library/2018-10-13-11-14-13.bpo-34970.SrJTY7.rst
0 → 100644
View file @
97cf0828
Protect tasks weak set manipulation in ``asyncio.all_tasks()``
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment