Skip to content

Pyright accepts an invalid ellipsis default value, outside of an interface or protocol #5985

@maxime-didier

Description

@maxime-didier

Describe the bug

The following unsound definition is accepted by pyright 1.1.337 in strict mode while mypy 1.4.1 in strict mode rejects it:

def the_bad(x: list[int] = ...) -> list[int]:
    return x

mypy --strict outputs the following for this definition:

error: Incompatible default for argument "x" (default has type "ellipsis", argument has type "list[int]")  [assignment]

Pyright should reject this program.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions