]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-140414: add fastpath for current running loop in `asyncio.all_tasks` (#140542)
authorKumar Aditya <kumaraditya@python.org>
Fri, 24 Oct 2025 14:32:17 +0000 (20:02 +0530)
committerGitHub <noreply@github.com>
Fri, 24 Oct 2025 14:32:17 +0000 (20:02 +0530)
commit95e5d596308620acbd860ec25a40ef95c2b62eaa
tree6d327ae225ab954d9f18a0feca1f9363bb9267ea
parentebf99384966344df77828e69dd88d34df878a7b6
gh-140414: add fastpath for current running loop in `asyncio.all_tasks` (#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()`.
Modules/_asynciomodule.c