Skip to content

gh-155143: Fix asyncio.shield leaking tasks via await-graph. - #155144

Merged
kumaraditya303 merged 3 commits into
python:mainfrom
pteromys:main
Aug 15, 2026
Merged

gh-155143: Fix asyncio.shield leaking tasks via await-graph.#155144
kumaraditya303 merged 3 commits into
python:mainfrom
pteromys:main

Conversation

@pteromys

@pteromys pteromys commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

There were two places where `cur_task` could live until `inner` ended:

1. `inner._asyncio_awaited_by`, and
2. as a capture in `_clear_awaited_by_callback` in `inner._callbacks`.
Comment thread Lib/test/test_asyncio/test_tasks.py Outdated
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Comment thread Lib/test/test_asyncio/test_tasks.py Outdated
@kumaraditya303
kumaraditya303 enabled auto-merge (squash) August 14, 2026 15:34
@kumaraditya303
kumaraditya303 merged commit fbd2e01 into python:main Aug 15, 2026
97 of 99 checks passed
@kumaraditya303 kumaraditya303 added needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Sep 11, 2026
@miss-islington-app

Copy link
Copy Markdown

Thanks @pteromys for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Thanks @pteromys for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Sep 11, 2026

Copy link
Copy Markdown

GH-157319 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Sep 11, 2026
@bedevere-app

bedevere-app Bot commented Sep 11, 2026

Copy link
Copy Markdown

GH-157320 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Sep 11, 2026
kumaraditya303 pushed a commit that referenced this pull request Sep 11, 2026
…H-155144) (#157319)

gh-155143: Fix asyncio.shield() leaking tasks via await-graph (GH-155144)
(cherry picked from commit fbd2e01)

Co-authored-by: Andrew Geng <pteromys@gmail.com>
hugovk pushed a commit that referenced this pull request Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants