Title: TaskGroup fails to cancel tasks pending creation, if that task starts a failing task · Issue #128550 · python/cpython · GitHub
Open Graph Title: TaskGroup fails to cancel tasks pending creation, if that task starts a failing task · Issue #128550 · python/cpython
X Title: TaskGroup fails to cancel tasks pending creation, if that task starts a failing task · Issue #128550 · python/cpython
Description: Bug report Bug description: this 'deadlocks' on eager tasks, but raises an EG as expected on regular 'lazy' tasks. import sys import asyncio if sys.version_info >= (3, 13): from asyncio import EventLoop elif sys.platform == "win32": from...
Open Graph Description: Bug report Bug description: this 'deadlocks' on eager tasks, but raises an EG as expected on regular 'lazy' tasks. import sys import asyncio if sys.version_info >= (3, 13): from asyncio import Even...
X Description: Bug report Bug description: this 'deadlocks' on eager tasks, but raises an EG as expected on regular 'lazy' tasks. import sys import asyncio if sys.version_info >= (3, 13): from ...
Opengraph URL: https://github.com/python/cpython/issues/128550
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"TaskGroup fails to cancel tasks pending creation, if that task starts a failing task","articleBody":"# Bug report\r\n\r\n### Bug description:\r\n\r\nthis 'deadlocks' on eager tasks, but raises an EG as expected on regular 'lazy' tasks.\r\n\r\n```python\r\nimport sys\r\nimport asyncio\r\n\r\n\r\nif sys.version_info \u003e= (3, 13):\r\n from asyncio import EventLoop\r\nelif sys.platform == \"win32\":\r\n from asyncio import ProactorEventLoop as EventLoop\r\nelse:\r\n from asyncio import SelectorEventLoop as EventLoop\r\n\r\n\r\ndef loop_factory():\r\n loop = EventLoop()\r\n loop.set_task_factory(asyncio.eager_task_factory)\r\n return loop\r\n\r\n\r\nasync def main():\r\n async with asyncio.TaskGroup() as tg:\r\n async def third_task():\r\n raise RuntimeError(\"third task failed\")\r\n\r\n async def second_task():\r\n tg.create_task(third_task())\r\n await asyncio.Event().wait()\r\n\r\n tg.create_task(second_task())\r\n\r\n# asyncio.run(main())\r\nasyncio.run(main(), loop_factory=loop_factory)\r\n```\r\n\r\n\r\n### CPython versions tested on:\r\n\r\n3.12, 3.13, 3.14\r\n\r\n### Operating systems tested on:\r\n\r\nLinux\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-128551\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/graingert","@type":"Person","name":"graingert"},"datePublished":"2025-01-06T15:52:23.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/128550/cpython/issues/128550"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:24b78826-1ff4-622c-ba48-2024d02f97ba |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 962C:1B1D69:234ABDE:305E1B5:696AC2F4 |
| html-safe-nonce | e8157b5279a8fe21ddb3367a2f0d7e59e1285d914aaaf32a03e5f51fcbfa81b5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NjJDOjFCMUQ2OToyMzRBQkRFOjMwNUUxQjU6Njk2QUMyRjQiLCJ2aXNpdG9yX2lkIjoiOTAxMzEwMjU3NjEyNjM2OTE2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | e998f75f9e3e0b3a2218b382b626b67a0e744fc3188971e9735725d361802819 |
| hovercard-subject-tag | issue:2770942422 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/128550/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3c1822089566f90d4877dd2fbe1b50431fbfbcd4fd876099d41311ddbf14eb2d/python/cpython/issues/128550 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3c1822089566f90d4877dd2fbe1b50431fbfbcd4fd876099d41311ddbf14eb2d/python/cpython/issues/128550 |
| og:image:alt | Bug report Bug description: this 'deadlocks' on eager tasks, but raises an EG as expected on regular 'lazy' tasks. import sys import asyncio if sys.version_info >= (3, 13): from asyncio import Even... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | graingert |
| hostname | github.com |
| expected-hostname | github.com |
| None | 986b6a1d774985095564e64d6963d11f094da3d0e2bfda2ab1a27d63662eb033 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 89ad2112b9c4e11df6a0c13c8c1f8eedd36b0977 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width