PyO3's coroutine type has accessible execution state
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.2k
- Forks
- 1k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 66
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 😊
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing PyO3's coroutine type and Python's inspect.getcoroutinestate expectations; the issue does not name implementation files or tests. Decide which coroutine states and interface should be exposed, then verify that coroutine state can be inspected directly or through a documented alternative without the current exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, rust
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100