Skip to content

A NoReturn type is needed #165

@o11c

Description

@o11c

In order to perform branch analysis, it is necessary to know which calls will never return normally. Examples are sys.exit (which always returns via exception) and os.exit (which never returns).

NoReturn should drop out of Union and dominate Intersection.

To manually mark a branch as dead, use cast(NoReturn, expression) in an expression context, or raise in statement context.

This can also be used as the return type of __init__ or __new__ or the metaclass's __call__ to indicate types that can't be normally instantiated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions