Skip to content

Direct "super" call of type.__init__ complains about type of first arg #3010

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
gvanrossum opened this issue Mar 15, 2017 · 1 comment
Closed
Labels
bug mypy got something wrong

Comments

@gvanrossum
Copy link
Member

gvanrossum commented Mar 15, 2017

Repro:

class M(type):
    def __init__(cls, name, base, attrs) -> None:
        type.__init__(cls, name, base, attrs)  # E: Argument 1 to "__init__" of "type" has incompatible type "M"; expected "type"

This appears to be a regression due to #2825 "Treat type equivalent to Type[Any]; fixes #2655" (@ilevkivskyi, reviewed by @ddfisher).

@gvanrossum gvanrossum added the bug mypy got something wrong label Mar 15, 2017
@ilevkivskyi
Copy link
Member

Yes, I remember I updated my PR after #2837 was merged, but I missed this corner case, sorry.

Here is a fix #3012

gvanrossum pushed a commit that referenced this issue Mar 16, 2017
Fixes #3010

This just takes care of a corner case: every metaclass is a subtype of Type[Any].
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