You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
asyncio.print_call_graph() loses the call stack at asynchronous generators #156980
* Task(name='consumer', id=0x105be89b0)
+ 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 producer()
| File '/Users/timofeiivankov/cpython/repro.py', line 11, in async consumer()
Actual:
* Task(name='consumer', id=0x105b089b0)
+ Call stack:
| File '/Users/timofeiivankov/cpython/repro.py', line 11, in async consumer()
Proposed fix: expose the wrapped generator as ag_gen and step over the wrapper through it
There might be similar issues when iterating over async gen with anext.
anext(agen) returns the async_generator_asend, so it is already covered by this fix. But anext(agen, default) is not because it returns anext_awaitable which doesnt expose async gen. Do you want me to create a new issue for that, or push to this one?
@kumaraditya303 hi! just created issue for anext. There are also issue with aiter(callable, stop_value). If you don't mind i can create issue and pr for it, or give you the details if you want to work on it yourself
I ran into the same missing field, as part of a different but related introspection goal (trying to find the future that a blocked async generator is blocked on).
Activity
kumaraditya303 commentedon Sep 5, 2026
There might be similar issues when iterating over async gen with
anext.deadlovelll commentedon Sep 5, 2026
anext(agen)returns theasync_generator_asend, so it is already covered by this fix. Butanext(agen, default)is not because it returnsanext_awaitablewhich doesnt expose async gen. Do you want me to create a new issue for that, or push to this one?kumaraditya303 commentedon Sep 5, 2026
A new issue would be better, I still need to think more about this case and
aitertoo.deadlovelll commentedon Sep 5, 2026
Thanks! I'll do it tomorrow. I can also look into what other cases there might be
kumaraditya303 commentedon Sep 5, 2026
cc @1st1 @pablogsal
deadlovelll commentedon Sep 6, 2026
@kumaraditya303 hi! just created issue for anext. There are also issue with
aiter(callable, stop_value). If you don't mind i can create issue and pr for it, or give you the details if you want to work on it yourselfkumaraditya303 commentedon Sep 6, 2026
You can create issues but wait for creating PR, I haven't decided yet how I want to to fix this and will likely work on this myself.
msullivan commentedon Sep 25, 2026
I ran into the same missing field, as part of a different but related introspection goal (trying to find the future that a blocked async generator is blocked on).