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

stubtest: metaclass is not taken into an account #13327

Closed
sobolevn opened this issue Aug 4, 2022 · 2 comments · Fixed by #13331
Closed

stubtest: metaclass is not taken into an account #13327

sobolevn opened this issue Aug 4, 2022 · 2 comments · Fixed by #13331
Assignees
Labels
bug mypy got something wrong topic-stubtest

Comments

@sobolevn
Copy link
Member

sobolevn commented Aug 4, 2022

Here's a simple example of this bug:

# runtime implementation
class A(type):
    def method(self) -> None:
        print('a')

class B(metaclass=A): ...

# This works:
# B.method()

And:

# type stub
class A(type):
    def method(self) -> None: ...

class B: ...  # notice that `metaclass=A` is missing, but `stubtest` does not produce any errors

Notice that this bug prevents using things like B.method() in your code.
I will send a fix asap.

Refs #13316

@sobolevn sobolevn added bug mypy got something wrong topic-stubtest labels Aug 4, 2022
@sobolevn sobolevn self-assigned this Aug 4, 2022
@sobolevn
Copy link
Member Author

sobolevn commented Aug 4, 2022

CC @AlexWaygood

@hauntsaninja
Copy link
Collaborator

Also note that stubtest currently doesn't check inheritance at all. I have a patch for this, but never got around to merging it. See python/typeshed#3968 for the patch / details

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-stubtest
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants