Skip to content

What to do if a stub has an incorrect bool return for __exit__ #7666

@JukkaL

Description

@JukkaL

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions