Skip to content

Regression in classmethod override #5259

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

Closed
ilevkivskyi opened this issue Jun 21, 2018 · 0 comments
Closed

Regression in classmethod override #5259

ilevkivskyi opened this issue Jun 21, 2018 · 0 comments
Assignees
Labels
bug mypy got something wrong false-positive mypy gave an error on correct code priority-0-high

Comments

@ilevkivskyi
Copy link
Member

This test currently fails, likely because of #5224 (but I didn't bisect).

[case testClassMethodOverride]
from typing import Callable, Any

def deco(f: Callable[..., Any]) -> Callable[..., Any]: ...

class B:
    @classmethod
    def meth(cls, x: int) -> int: ...

class C(B):
    @classmethod
    @deco
    def meth(cls, x: int) -> int: ...
[builtins fixtures/classmethod.pyi]
[out]
@ilevkivskyi ilevkivskyi added bug mypy got something wrong priority-0-high false-positive mypy gave an error on correct code labels Jun 21, 2018
@ilevkivskyi ilevkivskyi self-assigned this Jun 21, 2018
ilevkivskyi added a commit that referenced this issue Jun 21, 2018
Fixes #5259

This partially undo changes made in https://github.com/python/mypy/pull/5224/files. It is more safe to retrieve class and static flags directly from nodes, since callable types have often definition not set (especially after de-serialization). Also being class or static method is not really a property of type itself, it is rather an "access flag" for a given name in symbol table (similar to how a variable can be settable).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong false-positive mypy gave an error on correct code priority-0-high
Projects
None yet
Development

No branches or pull requests

1 participant