Skip to content

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

Merged
kumaraditya303 merged 1 commit into
python:3.14from
miss-islington:backport-2095eab-3.14
Oct 2, 2026
Merged

kumaraditya303 merged 1 commit into
python:3.14from
miss-islington:backport-2095eab-3.14

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>
@kumaraditya303
kumaraditya303 enabled auto-merge (squash) October 2, 2026 13:01
@kumaraditya303
kumaraditya303 merged commit 874218f into python:3.14 Oct 2, 2026
94 of 96 checks passed
@miss-islington
miss-islington deleted the backport-2095eab-3.14 branch October 2, 2026 14:25
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