Python 3.14+Async programmingterm
asyncio.FrameCallGraphEntry
call graph
A stack entry in the asyncio call graph: a wrapper around one frame (the frame field). FutureCallGraph.call_stack consists of them. Python 3.14+.
Syntax
for entry in graph.call_stack: entry.frame.f_code.co_name
It has a single field, frame — a real frame object, so the function name is entry.frame.f_code.co_name and the line is entry.frame.f_lineno. The first entry of call_stack is the innermost frame, where the coroutine is suspended right now. Do not keep frames beyond debugging: a frame holds every local variable of its function and keeps them from being freed.
Examples
import asyncio
async def inner():
await asyncio.sleep(0.01)
graph = asyncio.capture_call_graph()
return [e.frame.f_code.co_name for e in graph.call_stack]
async def outer():
return await inner()
async def main():
names = await asyncio.create_task(outer())
print(names) # → ['inner', 'outer']
asyncio.run(main())
See also
Open in the full glossarydocs.python.orgReport an inaccuracy