Skip to content

Type slots are not extensible #13

@encukou

Description

@encukou

Type slot functions (tp_new, nb_add) have fixed signatures, which makes it impossible to pass extra context. In particular

  • you can't easily get an equivalent of Python's __class__ cell, so you can't easily emulate super in heap types.
  • we can't pass a HPy-style context.
  • we can't change the signature, e.g. when tp_getattro was added, tp_getattr was kept around, complicating inheritance.
  • somewhat related, we can't easily implement flags like “this is a legacy function so it needs a GIL held” for nogil.
  • (edit) docstrings / type annotations can't be set for type slot wrappers

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions