FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-140414: add fastpath for current running loop in `asyncio.all_tasks` by kumaraditya303 · Pull Request #140542 · python/cpython · GitHub

Repository navigation

gh-140414: add fastpath for current running loop in asyncio.all_tasks - #140542

Merged
kumaraditya303 merged 3 commits into
python:mainfrom
kumaraditya303:all-tasks
Oct 24, 2025
Merged

kumaraditya303 merged 3 commits into
python:mainfrom
kumaraditya303:all-tasks

Conversation

kumaraditya303 commented Oct 24, 2025 •
edited
Loading

Copy link
Copy Markdown
Contributor

Optimize asyncio.all_tasks() for the common case where the event loop is running in the current thread by avoiding stop-the-world pause and locking. This optimization is already present for asyncio.current_task() so we do the same for asyncio.all_tasks().

… is running

in the current thread by avoiding stop-the-world pauses and locking.

This optimization is already present for asyncio.current_task() so we
do the same for asyncio.all_tasks().
Comment thread Modules/_asynciomodule.c Outdated

colesbury left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM

Comment thread Modules/_asynciomodule.c Outdated
Co-authored-by: Sam Gross <colesbury@gmail.com>
kumaraditya303 merged commit 95e5d59 into python:main Oct 24, 2025
43 checks passed
kumaraditya303 deleted the all-tasks branch October 24, 2025 14:32
StanFromIreland pushed a commit to StanFromIreland/cpython that referenced this pull request Dec 6, 2025
…l_tasks` (python#140542)

Optimize `asyncio.all_tasks()` for the common case where the event loop is running in the current thread by avoiding stop-the-world pauses and locking.

This optimization is already present for `asyncio.current_task()` so we do the same for `asyncio.all_tasks()`.
kumaraditya303 added the needs backport to 3.14 bugs and security fixes label Feb 5, 2026

Copy link
Copy Markdown

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

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 5, 2026
…l_tasks` (pythonGH-140542)

Optimize `asyncio.all_tasks()` for the common case where the event loop is running in the current thread by avoiding stop-the-world pauses and locking.

This optimization is already present for `asyncio.current_task()` so we do the same for `asyncio.all_tasks()`.
(cherry picked from commit 95e5d59)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>

bedevere-app Bot commented Feb 5, 2026

Copy link
Copy Markdown

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

bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Feb 5, 2026
kumaraditya303 added a commit that referenced this pull request Feb 6, 2026
…ll_tasks` (GH-140542) (#144494)

* gh-140414: add fastpath for current running loop in `asyncio.all_tasks` (GH-140542)

Optimize `asyncio.all_tasks()` for the common case where the event loop is running in the current thread by avoiding stop-the-world pauses and locking.

This optimization is already present for `asyncio.current_task()` so we do the same for `asyncio.all_tasks()`.
(cherry picked from commit 95e5d59)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL