PyO3's coroutine type has accessible execution state #4807
Open
Description
Hi,
At first I want to thank you for this awesome project!
Currently, (version 0.23.3), the coroutine type implemented by PyO3 has not attributes such as cr_running, cr_suspended or cr_frame. However, inspecting the status of the coroutine by inspect.getcoroutinestate(my_coro())
results in an exception.
Our use case is to monitor the status of tasks and coroutines to have more insights in their live cycle. It would be quite nice to have at least alternatives attributes or methods to access somehow the state of the coroutine (created/running/suspended/closed).
A current workaround is to wrap pyO3"s coroutine with a usual python coroutine in python code.
I guess in first place it would be a question of design rather implementation.
Thanks 😊