Title: `asyncio.print_call_graph()` loses the call stack at asynchronous generators · Issue #156980 · python/cpython · GitHub
Open Graph Title: `asyncio.print_call_graph()` loses the call stack at asynchronous generators · Issue #156980 · python/cpython
X Title: `asyncio.print_call_graph()` loses the call stack at asynchronous generators · Issue #156980 · python/cpython
Description: Bug report Bug description: asyncio.print_call_graph() stops at the first async gen in the await chain and silently drops all of the call stack below it Repro: import asyncio async def deep(): await asyncio.Event().wait() async def produ...
Open Graph Description: Bug report Bug description: asyncio.print_call_graph() stops at the first async gen in the await chain and silently drops all of the call stack below it Repro: import asyncio async def deep(): awai...
X Description: Bug report Bug description: asyncio.print_call_graph() stops at the first async gen in the await chain and silently drops all of the call stack below it Repro: import asyncio async def deep(): awai...
Opengraph URL: https://github.com/python/cpython/issues/156980
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`asyncio.print_call_graph()` loses the call stack at asynchronous generators","articleBody":"# Bug report\n\n### Bug description:\n\n`asyncio.print_call_graph()` stops at the first async gen in the await chain and silently drops all of the call stack below it \n\nRepro:\n\n```python\nimport asyncio\n\nasync def deep():\n await asyncio.Event().wait()\n\nasync def producer():\n await deep()\n yield 1\n\nasync def consumer():\n async for _ in producer():\n pass\n\nasync def main():\n t = asyncio.create_task(consumer(), name='consumer')\n await asyncio.sleep(0.05)\n print(asyncio.format_call_graph(t))\n\nasyncio.run(main())\n```\n\nExpected:\n\n```\n* Task(name='consumer', id=0x105be89b0)\n + Call stack:\n | File '/Users/timofeiivankov/cpython/Lib/asyncio/locks.py', line 210, in async Event.wait()\n | File '/Users/timofeiivankov/cpython/repro.py', line 4, in async deep()\n | File '/Users/timofeiivankov/cpython/repro.py', line 7, in async generator producer()\n | File '/Users/timofeiivankov/cpython/repro.py', line 11, in async consumer()\n```\n\nActual:\n\n```\n* Task(name='consumer', id=0x105b089b0)\n + Call stack:\n | File '/Users/timofeiivankov/cpython/repro.py', line 11, in async consumer()\n```\n\nProposed fix: expose the wrapped generator as `ag_gen` and step over the wrapper through it\n\nHave a fix ready for that \n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nmacOS\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-156984\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/deadlovelll","@type":"Person","name":"deadlovelll"},"datePublished":"2026-09-05T14:08:09Z","url":"https://github.com/python/cpython/issues/156980"}
| 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:4951ee01-2578-8963-aa0a-583b20e533f0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B3DE:2A98A:D4E72A:10BBEB3:6B0241C0 |
| html-safe-nonce | 0928a501f706a49edac6c4c2f720188f18c3f85e19274f246328a160b54365aa |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCM0RFOjJBOThBOkQ0RTcyQToxMEJCRUIzOjZCMDI0MUMwIiwidmlzaXRvcl9pZCI6IjgzMDUxNDk4NDU1NDQ4MDA2NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c9b14ba7a7fec0747d30ff9f099904f81763ab408f74945583743243cffd3229 |
| hovercard-subject-tag | issue:5358478568 |
| 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/156980/issue_layout |
| twitter:image | https://opengraph.githubassets.com/76b8560e573573849b4f93b3e5e1b5c4fd2f2536dd9e8a769fa57aba2eb2ddea/python/cpython/issues/156980 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/76b8560e573573849b4f93b3e5e1b5c4fd2f2536dd9e8a769fa57aba2eb2ddea/python/cpython/issues/156980 |
| og:image:alt | Bug report Bug description: asyncio.print_call_graph() stops at the first async gen in the await chain and silently drops all of the call stack below it Repro: import asyncio async def deep(): awai... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | deadlovelll |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| 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 | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width