Skip to content

Return type of dict.get is wrong when using strict optional checking #1732

Closed
@JukkaL

Description

@JukkaL

The revealed type in the following program is int though it should be Optional[int] when using --strict-optional:

d = {'x': 1}
a = d.get('y')
reveal_type(a)

This also needs a typeshed change, but I think that there was a mypy issue with overloaded functions that is related. It's worth having a separate issue to track this here.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions