Skip to content

Recognize functions like exit() as not returning #2280

Closed
@JukkaL

Description

@JukkaL

This generates a warning when using --warn-no-return, even though it's safe:

def f(x: int) -> int:
    if x == 0:
        return x
    exit(1)

It would be nice if mypy knew about at least the most common stdlib functions that never return such as sys.exit.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions