Skip to content
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

Update comments now that a std API is stable, but too high MSRV #4658

Merged
merged 1 commit into from
Oct 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,14 @@ impl<T: Element> FromPyObject<'_> for PyBuffer<T> {
impl<T: Element> PyBuffer<T> {
/// Gets the underlying buffer from the specified python object.
pub fn get(obj: &Bound<'_, PyAny>) -> PyResult<PyBuffer<T>> {
// TODO: use nightly API Box::new_uninit() once stable
// TODO: use nightly API Box::new_uninit() once our MSRV is 1.82
let mut buf = Box::new(mem::MaybeUninit::uninit());
let buf: Box<ffi::Py_buffer> = {
err::error_on_minusone(obj.py(), unsafe {
ffi::PyObject_GetBuffer(obj.as_ptr(), buf.as_mut_ptr(), ffi::PyBUF_FULL_RO)
})?;
// Safety: buf is initialized by PyObject_GetBuffer.
// TODO: use nightly API Box::assume_init() once stable
// TODO: use nightly API Box::assume_init() once our MSRV is 1.82
unsafe { mem::transmute(buf) }
};
// Create PyBuffer immediately so that if validation checks fail, the PyBuffer::drop code
Expand Down
Loading