Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

overriding attribute with property #10049

Closed
Akuli opened this issue Feb 8, 2021 · 1 comment
Closed

overriding attribute with property #10049

Akuli opened this issue Feb 8, 2021 · 1 comment
Labels
bug mypy got something wrong

Comments

@Akuli
Copy link
Contributor

Akuli commented Feb 8, 2021

Bug Report

To Reproduce

class Foo:
    blah: int = 123

class Bar(Foo):
    @property               # error: Signature of "blah" incompatible with supertype "Foo"
    def blah(self) -> int:  # error: Signature of "blah" incompatible with supertype "Foo"
        return 123

    @blah.setter
    def blah(self, value: int) -> None:
        pass

Expected Behavior

I would expect mypy to allow this, even though this is a bit of a hack, or if this is intentional, get an error message saying that this is a bad idea.

Actual Behavior

The errors written as comments

Your Environment

  • Mypy version used: happens with mypy 0.790 and 0.820+dev.2738c73695e2d2f963fbe2a0056329c43a0f6e58
  • Mypy command-line flags: none
  • Mypy configuration options from mypy.ini (and other config files): none
  • Python version used: 3.7.3
  • Operating system and version: debian 10 based linux distro with kernel 4.19.0-14-amd64
@Akuli Akuli added the bug mypy got something wrong label Feb 8, 2021
@troiganto
Copy link

This is very likely a duplicate of #4125

@Akuli Akuli closed this as completed Aug 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

No branches or pull requests

2 participants