Skip to content

False negative with property and decorator #16857

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

Open
hauntsaninja opened this issue Feb 2, 2024 · 0 comments
Open

False negative with property and decorator #16857

hauntsaninja opened this issue Feb 2, 2024 · 0 comments
Labels
bug mypy got something wrong

Comments

@hauntsaninja
Copy link
Collaborator

Relates to #5858 (fixed in #15926)

from typing import Callable

class something_callable:
    def __init__(self, fn):
        self.fn = fn
    def __call__(self, decorated_self, extra1, extra2, extra3) -> str:
        return self.fn(decorated_self)
    # def __call__(self) is also bad

def decorator(fn: Callable[..., int]) -> something_callable:
    return something_callable(fn)

class A:
    @property
    @decorator
    def f(self) -> int:
        return 42
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

1 participant