New submission from David Beazley <d...@dabeaz.com>:

Libraries such as Curio and asyncio provide a debugging facility that allows 
someone to view the call stack of generators/coroutines.  For example, the 
_task_get_stack() function in asyncio/base_tasks.py.  This works by manually 
walking up the chain of coroutines (by following cr_frame and gi_frame links as 
appropriate).   

The only problem is that it doesn't work if control flow falls into an async 
generator because an "async_generator_asend" instance is encountered and there 
is no meaningful way to proceed any further with stack inspection.

This problem could be fixed if "async_generator_asend" and 
"async_generator_athrow" instances exposed the underlying "ags_gen" and 
"agt_gen" attribute that's held inside the corresponding C structures in 
Objects/genobject.c.  

Note: I made a quick and dirty "hack" to Python to extract "ags_gen" and 
verified that having this information would allow me to get complete stack 
traces in Curio.

----------
messages: 311906
nosy: dabeaz
priority: normal
severity: normal
status: open
title: Expose ags_gen and agt_gen in asynchronous generators
type: enhancement
versions: Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32810>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to