]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.14] gh-140414: add fastpath for current running loop in `asyncio.all_tasks` (GH...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 6 Feb 2026 03:18:06 +0000 (04:18 +0100)
committerGitHub <noreply@github.com>
Fri, 6 Feb 2026 03:18:06 +0000 (08:48 +0530)
commitf4239df276a23277c37f449bc8633b3ecd40fa06
treef2c111201dec8e67bb0a3c4465d88a2aa2b31e65
parent6614a3c30c27de260363b3e37da0ac846e90a2c9
[3.14] gh-140414: add fastpath for current running loop in `asyncio.all_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 95e5d596308620acbd860ec25a40ef95c2b62eaa)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Misc/NEWS.d/next/Library/2026-02-05-13-16-57.gh-issue-144494.SmcsR3.rst [new file with mode: 0644]
Modules/_asynciomodule.c