Skip to content

Mypy incorrectly says signature is incompatible with supertype when using decorator #3260

Closed
@fniessink

Description

@fniessink

When checking the code below with mypy v0.501, mypy complains that

deco.py:10: error: Signature of "a" incompatible with supertype "A"

According to @ilevkivskyi this may be related to #1441.

import functools

class A:
  @functools.lru_cache()
  def a(self) -> str: 
    return 'a'

class B(A):
  @functools.lru_cache()
  def a(self) -> str:
    return super().a() + 'b'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions