Skip to content

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

Closed

Description

@gvanrossum

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"

Activity

  1. gvanrossum commented on Dec 11, 2015

    @gvanrossum
    MemberAuthor

    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.

  2. gvanrossum commented on Dec 11, 2015

    @gvanrossum
    MemberAuthor

    Interestingly, this is clean:

    from typing import Any
    A = ...  # type: Any
    class C(A):
        def __iter__(self):
            super(C, self).__iter__()
  3. JukkaL commented on Dec 11, 2015

    @JukkaL
    Collaborator

    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.

  4. added a commit that references this issue on Jan 16, 2016
    7be0b8c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions