]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-144881: Add retry logic to asyncio debugging tools (#148530)
authorBartosz Sławecki <bartosz@ilikepython.com>
Mon, 13 Apr 2026 22:10:54 +0000 (00:10 +0200)
committerGitHub <noreply@github.com>
Mon, 13 Apr 2026 22:10:54 +0000 (22:10 +0000)
commit4adffd9efad7052ad0a22743dd678d0201ec0286
treec15682da2a695dfaa82ce9dd81a89bda694d723d
parentbf452f7b2d9f5527cd8a8c0a364dd0235f5373e5
gh-144881: Add retry logic to asyncio debugging tools (#148530)

Transient errors can occur when attaching to a process that is actively
using thread delegation (e.g. asyncio.to_thread). Add a retry loop to
_get_awaited_by_tasks for RuntimeError, OSError, UnicodeDecodeError, and
MemoryError, and expose --retries CLI flag on both `ps` and `pstree`
subcommands (default: 3).

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
Lib/asyncio/__main__.py
Lib/asyncio/tools.py
Misc/NEWS.d/next/Library/2026-04-13-21-38-50.gh-issue-144881.3kPqXw.rst [new file with mode: 0644]