Skip to content

Migrating #[pyproto] to #[pymethods] #1884

Closed
@davidhewitt

Description

@davidhewitt

This is a tracking issue for the work remaining to complete the support for __dunder__ (aka "protocol") methods in #[pymethods].

As per the proposal in #1864, the current intention is to have a working but experimental implementation of this in 0.15. If any feedback from this implementation is ok, I'd suggest to deprecate #[pyproto] in 0.16 or 0.17. If we're happy with the whole implementation earlier / later we can always adjust these aims.

The items outstanding after #1864

  • Documentation
  • Some protocols which need design discussion:
    • The GC protocol - doesn't have a well-specified __dunder__ at the Python level, so we'll need to design one
    • The buffer protocol - same thing for this
    • The sequence protocol - it overlaps messily with the mapping protocol; we might want to do the same as what happens at the Python level, or we might want to make __sequence_getitem__ methods etc to be explicit. See also Allow taking slices when implementing PySequenceProtocol __getitem__ #1855
  • Suppport for multiple-pymethods feature
  • tests for
    • __delete__
    • __anext__
    • __aiter__
    • __index__
    • __int__
    • __float__
    • __invert__
  • (maybe) better argument extraction errors (if there's an error, the generated code won't say which argument failed, athough that's probably obvious as most these methods take at most one argument).
  • __call__
  • __new__ / __init__ ?
  • __getitem__ iteration. #1927 ?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions