Bug report
Bug description:
asyncio.gather() leaves a task as awaited by caller in the graph, but it actually not
import asyncio
async def survivor():
await asyncio.Future()
async def boom():
raise ValueError
async def main():
s = asyncio.ensure_future(survivor())
try:
await asyncio.gather(s, boom())
except ValueError:
print("valueerror")
asyncio.print_call_graph(s)
s.cancel()
asyncio.run(main())
Expected:
❯ ./python repro.py
valueerror
* Task(name='Task-2', id=0x719b21d58b90)
+ Call stack:
| File '/home/timofei/Desktop/cpython/repro.py', line 4, in async survivor()
Actual:
❯ ./python repro.py
valueerror
* Task(name='Task-2', id=0x7fe4a47e0b90)
+ Call stack:
| File '/home/timofei/Desktop/cpython/repro.py', line 4, in async survivor()
+ Awaited by:
* Task(name='Task-1', id=0x7fe4a47e0d70)
+ Call stack:
| File '/home/timofei/Desktop/cpython/repro.py', line 15, in async main()
Proposed fix: discard edges on the gather future
I have a fix ready for that
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
Bug report
Bug description:
asyncio.gather()leaves a task as awaited by caller in the graph, but it actually notExpected:
Actual:
Proposed fix: discard edges on the gather future
I have a fix ready for that
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs