8000 gh-128002: fix `asyncio.all_tasks` against concurrent deallocations of tasks by kumaraditya303 · Pull Request #128541 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-128002: fix asyncio.all_tasks against concurrent deallocations of tasks #128541

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 9, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix comment
  • Loading branch information
kumaraditya303 committed Jan 7, 2025
commit 0b6922e44907eaec778396cf8c1cbf07c0c7f0d1
4 changes: 2 additions & 2 deletions Modules/_asynciomodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -3773,9 +3773,9 @@ _asyncio_all_tasks_impl(PyObject *module, PyObject *loop)
llist_for_each_safe(node, &state->asyncio_tasks_head) {
TaskObj *task = llist_data(node, TaskObj, task_node);
// The linked list holds borrowed references to task
// as such it is possible that it can concurrently
// as such it is possible that the task is concurrently
// deallocated while added to this list.
// To protect against concurrent deallocation,
// To protect against concurrent deallocations,
// we first try to incref the task which would fail
// if it is concurrently getting deallocated in another thread,
// otherwise it gets added to the list.
Expand Down
Loading
0