gh-128588: gh-128550: remove eager tasks optimization that missed and introduced incorrect cancellations by graingert · Pull Request #129063 · python/cpython · GitHub

github.com

Tin mới

graingert:fix-eager-tasks-early-callback

miss-islington-app

GitHub CopilotWrite better code with AI

GitHub Copilot appDirect agents from issue to merge

ActionsAutomate any workflow

CodespacesInstant dev environments

IssuesPlan and track work

Code ReviewManage code changes

Code QualityEnforce quality at merge

GitHub Advanced SecurityFind and fix vulnerabilities

Code securitySecure your code as you build

Secret protectionStop leaks before they start

View all use cases

Financial services

View all industries

Software Development

GitHub SponsorsFund open source developers

Copilot for BusinessEnterprise-grade AI features

Premium SupportEnterprise-grade 24/7 support

Pull requests 2.6k

Security and quality 0

Cancellation leaks out of asyncio.TaskGroup on 3.12 when using eager tasks #128588

TaskGroup fails to cancel tasks pending creation, if that task starts a failing task #128550

gh-128588: gh-128550: remove eager tasks optimization that missed and introduced incorrect cancellations

📜🤖 Added by blurb_it.

TaskGroup's task's exception's participate in a reference cycle, via TaskGroup.create_task -> task -> exception and loop.create_task -> task -> exception #128552

View reviewed changes

Update Lib/test/test_asyncio/test_taskgroups.py

View reviewed changes

Update Lib/test/test_asyncio/test_taskgroups.py

Update Misc/NEWS.d/next/Library/2025-01-20-13-12-39.gh-issue-128550.A…

View reviewed changes

Update Lib/test/test_asyncio/test_taskgroups.py

Update Misc/NEWS.d/next/Library/2025-01-20-13-12-39.gh-issue-128550.A…

View reviewed changes

needs backport to 3.12

needs backport to 3.12

needs backport to 3.13

needs backport to 3.13

: remove eager tasks optimization tha…

bedevere-app Bot commented Jan 20, 2025

bedevere-app Bot commented Jan 20, 2025

GH-129089 is a backport of this pull request to the 3.13 branch.

: remove eager tasks optimization that mis…

gh-128588: gh-128550: remove eager tasks optimization that missed and introduced incorrect cancellations (#129063) Co-authored-by: Kumar Aditya <[email protected]>

[3.12] gh-128588: fix refcycles in eager task creation and remove eager tasks optimization that missed and introduced incorrect cancellations (#129063) (#128586) Co-authored-by: Kumar Aditya <[email protected]>

gh-128588: gh-128550: remove eager tasks optimization that missed and introduced incorrect cancellations (#129063) Co-authored-by: Kumar Aditya <[email protected]>

https://github.com/faster-cpython/benchmarking-public/blob/main/results/bm-20250120-3.14.0a4%2B-ed6934e/bm-20250120-linux-x86_64-python-ed6934e71e55d398df82-3.14.0a4%2B-ed6934e-vs-base.md#benchmarks-with-tag-asyncio

The results are now at https://github.com/faster-cpython/benchmarking-public/blob/main/results/bm-20250120-3.14.0a4%2B-ed6934e/bm-20250120-linux-x86_64-python-ed6934e71e55d398df82-3.14.0a4%2B-ed6934e-vs-base.md#benchmark

at the original PR

Hmm, I think I see what's going on here.. Looking more closely at the original PR, it appears the benchmarking used a patched version of pyperformance to add an "eager" flavor to the async tree benchmarks. Since these fl