-
Notifications
You must be signed in to change notification settings - Fork 784
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PEP 688 buffer methods #3148
Comments
I wrote PEP 688 and I'd be happy to answer any questions you may have. In the CPython implementation I had to be very careful in what kind of calls to |
Thanks @JelleZijlstra. Do you wrap the |
Any call to |
Great, in which case that should apply to us, so the action here for us is just to replace our current |
PEP 688 defines new methods
__buffer__
and__release_buffer__
with signatures as follows:At the moment we have
__getbuffer__
and__releasebuffer__
which have slightly different signatures, because they deal in theffi::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).The text was updated successfully, but these errors were encountered: