Skip to content

False positive: Protocol member cannot be final in non-instance assignment in a method #17281

Closed
@bzoracler

Description

@bzoracler

Bug Report, reproduction, & actual behaviour

See mypy Playground:

import typing as t

class A(t.Protocol):
    def method(self) -> None:
        var: t.Final = 0  # mypy: Protocol member cannot be final  [misc]

Expected Behavior

No issues

Your Environment

  • Mypy version used: 1.10
  • Mypy command-line flags: None
  • Mypy configuration options from mypy.ini (and other config files): None
  • Python version used: 3.10, 3.12

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions