Skip to content

Add support for defining metaclasses in Rust #5958

@MatthieuDartiailh

Description

@MatthieuDartiailh

Declaring a metaclass in Rust requires to extend PyType and to adapt the default new implementation (since a metaclass should always allow to create a class in Python).

This would allow for efficient implementation of __instancecheck__ and __subclasscheck__. It would also allow to keep track of information about created classes in Rust instead of storing them as standard attributes on the class which can be modified later.

I am fine doing the changes. I am however open to suggestions as to where to document this.

Specifying a metaclass when defining a class in Rust is out of scope.

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