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

When base class has type 'Any', super().__init__() args should be unconstrained #1067

Closed
gvanrossum opened this issue Dec 11, 2015 · 3 comments
Labels
bug mypy got something wrong

Comments

@gvanrossum
Copy link
Member

Demo:

from typing import Any
A = ...  # type: Any
class C(A):
    def __init__(self):
        super(C, self).__init__(1, 2, 3)  # E: Too many arguments for "__init__" of "object"
@gvanrossum
Copy link
Member Author

Maybe this issue should also track other problems related to the base class being an object of type 'Any'? E.g. this one:

def outer(cls):
    class C(cls):  # E: Invalid type "cls"
        def __iter__(self):
            super(C, self).__iter__()  # E: "__iter__" undefined in superclass

Update: Added a second error on the class statement. Also, adding an annotation of Any to the cls argument does not silence either error.

@gvanrossum
Copy link
Member Author

Interestingly, this is clean:

from typing import Any
A = ...  # type: Any
class C(A):
    def __iter__(self):
        super(C, self).__iter__()

@JukkaL JukkaL added bug mypy got something wrong priority labels Dec 11, 2015
@JukkaL
Copy link
Collaborator

JukkaL commented Dec 11, 2015

There have been a bunch of issues with Any base classes and it's probably worth creating separate issues if things seem not directly related.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

No branches or pull requests

2 participants