Open
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-asynciotype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Excessive depth makes asyncio.print_call_graph() include event loop internals
Repro:
import asyncio
async def main():
asyncio.print_call_graph(depth=2)
asyncio.run(main())Actual:
* Task(name='Task-1', id=0x101ff85f0)
+ Call stack:
| File '/Users/timofeiivankov/cpython/Lib/asyncio/events.py', line 91, in Handle._run()
| File '/Users/timofeiivankov/cpython/Lib/asyncio/base_events.py', line 2092, in BaseEventLoop._run_once()
| File '/Users/timofeiivankov/cpython/Lib/asyncio/base_events.py', line 683, in BaseEventLoop.run_forever()
| File '/Users/timofeiivankov/cpython/Lib/asyncio/base_events.py', line 712, in BaseEventLoop.run_until_complete()
| File '/Users/timofeiivankov/cpython/Lib/asyncio/runners.py', line 130, in Runner.run()
| File '/Users/timofeiivankov/cpython/Lib/asyncio/runners.py', line 211, in run()
| File '/Users/timofeiivankov/cpython/repro.py', line 6, in <module>()
Expected:
* Task(name='Task-1', id=0x1011345f0)
Proposed fix: apply depth after collecting the stack up to the task boundary
I'll work on the fix
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Linked PRs
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-asynciotype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Projects
- StatusShow more project fieldsTodo
Activity
pythongh-161124: Fix asyncio call graph reporting event loop frames f…
gh-161124: Fix asyncio call graph reporting event loop frames for exc…