Title: `TaskGroup` reports a child task's `SystemExit` as not propagated · Issue #162492 · python/cpython · GitHub
Open Graph Title: `TaskGroup` reports a child task's `SystemExit` as not propagated · Issue #162492 · python/cpython
X Title: `TaskGroup` reports a child task's `SystemExit` as not propagated · Issue #162492 · python/cpython
Description: Bug description: When a child task of an asyncio.TaskGroup raises SystemExit or KeyboardInterrupt, the task group propagates that exception and also passes it to the event loop's exception handler as an exception that was "not propagated...
Open Graph Description: Bug description: When a child task of an asyncio.TaskGroup raises SystemExit or KeyboardInterrupt, the task group propagates that exception and also passes it to the event loop's exception handler ...
X Description: Bug description: When a child task of an asyncio.TaskGroup raises SystemExit or KeyboardInterrupt, the task group propagates that exception and also passes it to the event loop's exception hand...
Opengraph URL: https://github.com/python/cpython/issues/162492
X: @github
Domain: github.com
IPv4 address: 140.82.112.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`TaskGroup` reports a child task's `SystemExit` as not propagated","articleBody":"### Bug description:\n\nWhen a child task of an `asyncio.TaskGroup` raises `SystemExit` or `KeyboardInterrupt`, the task group propagates that exception and also passes it to the event loop's exception handler as an exception that was \"not propagated\".\n\n```python\nimport asyncio\n\nasync def child():\n raise SystemExit(3)\n\nasync def main():\n loop = asyncio.get_running_loop()\n loop.set_exception_handler(lambda loop, ctx: print(ctx['message'], repr(ctx['exception'])))\n async with asyncio.TaskGroup() as tg:\n tg.create_task(child())\n await asyncio.sleep(1)\n\nasyncio.run(main())\n```\n\nOutput on main (the process exits with status 3):\n\n```\nTaskGroup task exception was not propagated because the TaskGroup body is being closed with a BaseException SystemExit(3)\nTask exception was never retrieved SystemExit(3)\n```\n\nThe first line comes from the reporting added for gh-135736 and is new in 3.16; 3.15 prints only the second line. With the default exception handler it is logged as an error with the full traceback of the `SystemExit`.\n\nExpected: the exception that propagates out of the task group is not reported. Errors from other tasks are still reported.\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nLinux\n\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-162494\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/fedonman","@type":"Person","name":"fedonman"},"datePublished":"2026-11-23T18:07:12Z","url":"https://github.com/python/cpython/issues/162492"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:aa0f6921-b8b8-5cd7-215e-dda0ef8eda05 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 88F8:39ABD:A81220:E14B6C:6B06420D |
| html-safe-nonce | d30ff864b5e828ec6428606aceb5893af48c8753f71ae674e6519967e2a175bb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OEY4OjM5QUJEOkE4MTIyMDpFMTRCNkM6NkIwNjQyMEQiLCJ2aXNpdG9yX2lkIjoiODQ4ODU0MzMyNjYwODcwNDAxMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 7adabc681489606048b7b6d775eb1f65b1822e6e9c6a6b8d467ff95df2d55d51 |
| hovercard-subject-tag | issue:6565712016 |
| 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/162492/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f77e0e4d7c2218832d6a2b04218f358d50391d335028c25c3cce9fb2e189a53e/python/cpython/issues/162492 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f77e0e4d7c2218832d6a2b04218f358d50391d335028c25c3cce9fb2e189a53e/python/cpython/issues/162492 |
| og:image:alt | Bug description: When a child task of an asyncio.TaskGroup raises SystemExit or KeyboardInterrupt, the task group propagates that exception and also passes it to the event loop's exception handler ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | fedonman |
| hostname | github.com |
| expected-hostname | github.com |
| None | 1bff4f6bfaa96dc9c42cacf315424c24ebb548b06142ced5e3aaccb2a42dd652 |
| 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 | ac613d3698d3d8565651455086e1f74da07bf277 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width