What to do if a stub has an incorrect bool return for __exit__
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
If the line after a with statement becomes reachable because a stub has __exit__ annotated to return bool, even though the actual runtime return value is always False, this can result in confusing missing return statement errors.
One way to deal with this would be to detect this and add a note saying that the __exit__ return type may be causing a spurious error.
Follow-up to #7655. See #7577 for context.
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 context in issues #7655 and #7577, then reproduce the missing return statement error with a stub whose exit is annotated to return bool. Done should include a targeted diagnostic or note explaining when this annotation causes the spurious error, with tests covering the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100