`@deprecated` overloads for invalid uses of `contextlib.ContextDecorator`?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.1k
- Forks
- 2.1k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 82
Description
https://github.com/python/cpython/issues/125862 describes some problems that can occur when applying a ContextDecorator to an async function or a generator function. Is it reasonable to add overloads returning Never for such cases, so that typecheckers can warn people?
The code in question runs, but it doesn't do anything useful let alone have the expected effect, so I'd love to warn about it sooner than CPython will release a fix.
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 reading the linked CPython issue and the existing ContextDecorator stubs in typeshed. Determine how async and generator functions are represented, then add overloads returning Never if appropriate and verify that type checkers warn for those uses.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100