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 produce no error when @abstractmethod is omitted from stubs #13322

Closed
sobolevn opened this issue Aug 4, 2022 · 1 comment · Fixed by #13323
Closed

stubtest produce no error when @abstractmethod is omitted from stubs #13322

sobolevn opened this issue Aug 4, 2022 · 1 comment · Fixed by #13323
Assignees
Labels
bug mypy got something wrong topic-stubtest

Comments

@sobolevn
Copy link
Member

sobolevn commented Aug 4, 2022

If I have this runtime implementation:

from abc import abstractmethod

class A:
    @abstractmethod
    def some(self) -> None:
        raise NotImplementedError

And this stub:

class A:
    def some(self) -> None: ...

There's no error.

Why is that important?
Because with the stub like above, mypy will allow to create an instance of A.
But, mypy should not be allow to do that.

I think it is a bug that should be fixed. And it is a pretty easy one.

@sobolevn sobolevn added bug mypy got something wrong topic-stubtest labels Aug 4, 2022
@sobolevn sobolevn self-assigned this Aug 4, 2022
@sobolevn sobolevn changed the title stubtest produce no error when @abstractmethod is ommited from stubs stubtest produce no error when @abstractmethod is omitted from stubs Aug 4, 2022
@AlexWaygood
Copy link
Member

AlexWaygood commented Aug 4, 2022

I used a stubtest patch along these lines to work on this typeshed PR in March:

But I never got round to writing tests and submitting a PR to mypy. I'm glad you're picking it up :D

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