Skip to content

Add support for classmethod property from python3.9 #11619

Closed as not planned
Closed as not planned
@YaN-3k

Description

@YaN-3k
class Foo:
    @classmethod
    @property
    def bar(cls) -> str:
        return cls.__name__ 


def foo_bar(msg: str) -> None:
    print(msg)

foo_bar(Foo.bar)

mypy --python-version 3.9 test.py
test.py:11: error: Argument 1 to "foo_bar" has incompatible type "Callable[[], str]"; expected "str"
Found 1 error in 1 file (checked 1 source file)

As stated in https://docs.python.org/3.9/library/functions.html#classmethod this new classmethod property is completely valid so mypy shouldn't report an error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions