Skip to content

c.__subclasses__(c) requires explicit self as input argument when c inherits from StructMeta #988

@mcrumiller

Description

@mcrumiller

Description

Calling __subclasses__() to get the list of subclasses of a class derived from StructMeta requires that the class be explicitly passed into the function call, which is a bit redundant:

from abc import ABC
from msgspec import Struct, StructMeta

class A1(ABC): ...
class C1(Struct): ...
class C2(StructMeta): ...

A1.__subclasses__()    # OK
C1.__subclasses__()    # OK
C2.__subclasses__()    # ERROR: Argument missing for parameter "self"
C2.__subclasses__(C2)  # OK

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions