-
Notifications
You must be signed in to change notification settings - Fork 909
Open
Description
PEP 688 defines new methods __buffer__ and __release_buffer__ with signatures as follows:
def __buffer__(self, flags: int, /) -> memoryview: ...
def __release_buffer__(self, buffer: memoryview, /) -> None: ...At the moment we have __getbuffer__ and __releasebuffer__ which have slightly different signatures, because they deal in the ffi::Py_buffer type.
It would be nice if we could support the PEP 688 methods, ideally with a way to use the full ffi::Py_buffer flexibility when users need it.
One option could be that we only support the PEP 688 way as first-class, and then allow the user to annotate a method with #[pyo3(unsafe_type_slot = bf_getbuffer)] to directly insert a method into the buffer slot (this could be generally useful for all type slots without requiring us to write any special machinery).
JerzySpendel
Metadata
Metadata
Assignees
Labels
No labels