Bug report
Bug description:
Task that created by eager task factory runs its first step before the awaited_by edge is registered. During this step the graph shows that this task is awaited by nobody
Repro:
import asyncio
async def child():
asyncio.print_call_graph()
await asyncio.sleep(0)
async def main():
await asyncio.gather(child())
loop = asyncio.new_event_loop()
loop.set_task_factory(asyncio.eager_task_factory)
loop.run_until_complete(main())
Expected:
* Task(name='Task-2', id=0x103544b90)
+ Call stack:
| File '/Users/timofeiivankov/cpython/repro.py', line 4, in async child()
+ Awaited by:
* Task(name='Task-1', id=0x103544d70)
+ Call stack:
| File '/Users/timofeiivankov/cpython/repro.py', line 8, in async main()
Actually:
* Task(name='Task-2', id=0x103058b90)
+ Call stack:
| File '/Users/timofeiivankov/cpython/repro.py', line 4, in async child()
With the default task factory it works fine as expected
Proposed fix: Register the edge inside the eager start and discard it when the step ends
I have a fix ready
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Linked PRs
Bug report
Bug description:
Task that created by eager task factory runs its first step before the
awaited_byedge is registered. During this step the graph shows that this task is awaited by nobodyRepro:
Expected:
Actually:
With the default task factory it works fine as expected
Proposed fix: Register the edge inside the eager start and discard it when the step ends
I have a fix ready
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Linked PRs