-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Virtual subclasses of abstract base classes #1459
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
Comments
ABC.register() is not supported and it's unclear to me how it could be supported without a relatively big change to mypy. It probably would require an extra pass over the code looking for register() calls everywhere. The only thing that's easy to do is to add register() to the stubs in typeshed -- can you send a PR for that? |
Hmm, there might be another issue with metaclasses that prevents me from adding register to typeshed: class M(type):
def test(cls):
pass
class C(metaclass=M):
pass
C.test() # error: "C" has no attribute "test" |
Ohh... Yes, that looks like we have a problem with metaclasses. |
FWIW, this is a pretty common/frustrating bug in the Python ecosystem, here's the equivalent IntelliJ/PyCharm issue. |
For For generalised metaclass support, this example no longer reproduces on mypy 0.941. |
Seeing a couple of different errors with virtual subclasses:
The text was updated successfully, but these errors were encountered: