Bug report
Bug description:
Adding a default to anext() hides everything the generator is waiting on
Repro:
import asyncio
async def deep():
await asyncio.Event().wait()
async def rows():
await deep()
yield 1
async def worker():
await anext(rows(), None)
async def main():
t = asyncio.create_task(worker(), name='worker')
await asyncio.sleep(0.05)
asyncio.print_call_graph(t)
t.cancel()
asyncio.run(main())
Expected:
* Task(name='worker', id=0x103a049b0)
+ Call stack:
| File '/Users/timofeiivankov/cpython/Lib/asyncio/locks.py', line 210, in async Event.wait()
| File '/Users/timofeiivankov/cpython/repro.py', line 4, in async deep()
| File '/Users/timofeiivankov/cpython/repro.py', line 7, in async generator rows()
| File '/Users/timofeiivankov/cpython/repro.py', line 11, in async worker()
Actual:
* Task(name='worker', id=0x1035c89b0)
+ Call stack:
| File '/Users/timofeiivankov/cpython/repro.py', line 11, in async worker()
Proposed fix: expose ag_gen on anext_awaitable like #156984 do
Important: Currently this issue have a blocker from #156984 (issue - #156980) because it depends on the fix of it. I have a fix ready and will open a PR once #156984 is merged
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Bug report
Bug description:
Adding a default to
anext()hides everything the generator is waiting onRepro:
Expected:
Actual:
Proposed fix: expose
ag_genonanext_awaitablelike #156984 doImportant: Currently this issue have a blocker from #156984 (issue - #156980) because it depends on the fix of it. I have a fix ready and will open a PR once #156984 is merged
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS