-
Notifications
You must be signed in to change notification settings - Fork 941
Closed
Labels
Description
At the moment PyBufferProtocol requires users to initialize the raw ffi::Py_Buffer structure in a pointer.
This forces the user to write unsafe code. It would be nice to rewrite this protocol to offer something better.
Prompted by the below discussion:
In the future I would like to remove Py_buffer::new(), but I think to do so right now would be inconvenient for users because PyBufferProtocol basically forces you to handle the raw ffi pointer (which probably points to uninitialized memory which C created).
I chose MaybeUninit here because that's pretty much identical to what C would do: we create a slab of memory and pass its location to PyObject_GetBuffer to initialize the contents.
Originally posted by @davidhewitt in #1534 (comment)
Reactions are currently unavailable