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

(🐞) no error when overriding read only property with attribute not initialised in class body #13230

Closed
KotlinIsland opened this issue Jul 24, 2022 · 1 comment
Labels
bug mypy got something wrong topic-descriptors Properties, class vs. instance attributes

Comments

@KotlinIsland
Copy link
Contributor

class Foo: 
    @property
    def foo(self) -> int: ...
class Bar(Foo):
    foo: int
    def __init__(self) -> None:
       self.foo = 2  # runtime error
Bar()

playground

@KotlinIsland KotlinIsland added the bug mypy got something wrong label Jul 24, 2022
@AlexWaygood AlexWaygood added the topic-descriptors Properties, class vs. instance attributes label Jul 24, 2022
@AlexWaygood
Copy link
Member

Closing in favour of #14413 (this bug report was filed first, but there's more description in #14413 of exactly why this behaviour is problematic)

@AlexWaygood AlexWaygood closed this as not planned Won't fix, can't repro, duplicate, stale Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong topic-descriptors Properties, class vs. instance attributes
Projects
None yet
Development

No branches or pull requests

2 participants