PyO3 / PyO3/pyo3

Issue a warning when coroutine is never awaited

Open
#3,597 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
16.2k
Forks
1k
Avg merge
2d 6h
Merged PRs (30d)
66

Description

Following #3588, coroutines should issue a warning when they are never awaited, to mimic Python coroutine behavior.

However, the best place to put this warning seems to be in __del__, so it would requires #2479 before.

"Never awaited" means (for Python coroutines) that the coroutine has not been polled at least once. Regarding current coroutine implementation, it means that waker field is still None when __del__ is executed.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the coroutine implementation and its del path, then review issue #2479 for the required prerequisite. The work is done when an unpolled coroutine, identified by waker still being None, emits a warning on destruction while a coroutine polled at least once does not.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.