Skip to content

Strange behavior when superclass is an unknown argument #1069

Description

@gvanrossum

Forking this issue from #1067. Example:

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

Neither error goes away when I annotate the 'cls' argument as having type 'Any'. Also interesting: this gives the same two errors:

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

but here annotating 'cls' as type 'Any' does make the errors disappear.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions