Skip to content

[3.15] gh-156321: Don't eagerly log exceptions from a cancelled asyncio.shield() (GH-158590) - #158598

Open
miss-islington wants to merge 1 commit into
python:3.15from
miss-islington:backport-2095eab-3.15
Open

miss-islington wants to merge 1 commit into
python:3.15from
miss-islington:backport-2095eab-3.15

Conversation

@miss-islington

@miss-islington miss-islington commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

When the outer future returned by shield() was cancelled, a callback was
added to the inner future that reported its exception through the loop
exception handler as soon as it completed, even if the exception was
retrieved afterwards by awaiting the inner future or calling
exception(). Remove the callback; an exception nobody retrieves is
still reported by the inner future itself when it is garbage collected,
like any other future.
(cherry picked from commit 2095eab)

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

…o.shield() (pythonGH-158590)

When the outer future returned by shield() was cancelled, a callback was
added to the inner future that reported its exception through the loop
exception handler as soon as it completed, even if the exception was
retrieved afterwards by awaiting the inner future or calling
`exception()`. Remove the callback; an exception nobody retrieves is
still reported by the inner future itself when it is garbage collected,
like any other future.
(cherry picked from commit 2095eab)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
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.

2 participants