Skip to content

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

Closed

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.

Activity

  1. added a commit that references this issue on Feb 23, 2026
    b972d9a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions