Skip to content

[stubtest] Better checking of Final variables with literal values #20857

@brianschubert

Description

@brianschubert

Given the runtime definition:

FOO = 1

stubtest currently generates an error for this stub:

FOO: Literal[2]  # E: FOO variable differs from runtime type Literal[1]

but not for this:

FOO: Final = 2

It would be helpful if stubtest emitted an error for the latter case as well. See e.g. python/typeshed#15446, python/typeshed#15447 for cases where discrepancies like this have snuck into typeshed.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions