You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
asyncio.print_call_graph() includes its own frame in the call stack #156327
* Task(name='test', id=0x1039f0fe0)
+ Call stack:
| File 't2.py', line 4, in async test()
+ Awaited by:
* Task(name='Task-1', id=0x103a5e060)
+ Call stack:
| File 'taskgroups.py', line 107, in async TaskGroup.__aexit__()
| File 't2.py', line 7, in async main()
But actually it mentions print_call_graph() in the graph which is not correct
* Task(name='test', id=0x103d349b0)
+ Call stack:
| File '/Users/timofeiivankov/cpython/Lib/asyncio/graph.py', line 276, in print_call_graph()
| File '/Users/timofeiivankov/cpython/repro.py', line 4, in async test()
+ Awaited by:
* Task(name='Task-1', id=0x103d34b90)
+ Call stack:
| File '/Users/timofeiivankov/cpython/Lib/asyncio/taskgroups.py', line 125, in async TaskGroup._aexit()
| File '/Users/timofeiivankov/cpython/Lib/asyncio/taskgroups.py', line 75, in async TaskGroup.__aexit__()
| File '/Users/timofeiivankov/cpython/repro.py', line 7, in async main()
Proposed fix is to increment the depth in print_call_graph():
defprint_call_graph(
future: futures.Future|None=None,
/,
*,
file: io.Writer[str] |None=None,
depth: int=1,
limit: int|None=None,
) ->None:
"""Print the async call graph for the current task or the provided Future."""print(format_call_graph(future, depth=depth+1, limit=limit), file=file)
changed the title [-]`asyncio.print_call_graph()` incorrect output[/-][+]`asyncio.print_call_graph()` includes its own frame in the call stack[/+]on Aug 24, 2026
Activity
[-]`asyncio.print_call_graph()` incorrect output[/-][+]`asyncio.print_call_graph()` includes its own frame in the call stack[/+]Merge branch 'main' into pythongh-156327-graph
gh-156327: Fix asyncio.print_call_graph() reporting its own frame (#1…
pythongh-156327: Fix asyncio.print_call_graph() reporting its own fra…