Skip to content

Cannot extend with more TypeVars generic class with __init_subclass__ #141280

@gsakkis

Description

@gsakkis

Bug report

Bug description:

class Parent[T]:
    def __init_subclass__(cls, **kw):
        pass


class Child[S, T](Parent[T]):
    pass


Child[int, float]

Output:

TypeError: Too many arguments for <class '__main__.Child'>; actual 2, expected 1

CPython versions tested on:

3.12

Operating systems tested on:

macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytopic-typingtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions