Merge pull request #968 from PyO3/davidhewitt-patch-3

Tidy up docs for from_borrowed_ptr methods
This commit is contained in:
Yuji Kanagawa 2020-06-09 19:25:16 +09:00 committed by GitHub
commit 4317f16a99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -404,10 +404,9 @@ impl<'p> Python<'p> {
FromPyPointer::from_owned_ptr_or_opt(self, ptr) FromPyPointer::from_owned_ptr_or_opt(self, ptr)
} }
/// Registers the borrowed object pointer in the release pool. /// Does an unchecked downcast to the specific type.
/// ///
/// Panics if the pointer is NULL. /// Panics if the pointer is NULL.
/// Does an unchecked downcast to the specific type.
#[allow(clippy::wrong_self_convention)] #[allow(clippy::wrong_self_convention)]
pub unsafe fn from_borrowed_ptr<T>(self, ptr: *mut ffi::PyObject) -> &'p T pub unsafe fn from_borrowed_ptr<T>(self, ptr: *mut ffi::PyObject) -> &'p T
where where
@ -416,10 +415,9 @@ impl<'p> Python<'p> {
FromPyPointer::from_borrowed_ptr(self, ptr) FromPyPointer::from_borrowed_ptr(self, ptr)
} }
/// Registers the borrowed object pointer in the release pool. /// Does an unchecked downcast to the specific type.
/// ///
/// Returns `Err(PyErr)` if the pointer is NULL. /// Returns `Err(PyErr)` if the pointer is NULL.
/// Does an unchecked downcast to the specific type.
#[allow(clippy::wrong_self_convention)] #[allow(clippy::wrong_self_convention)]
pub unsafe fn from_borrowed_ptr_or_err<T>(self, ptr: *mut ffi::PyObject) -> PyResult<&'p T> pub unsafe fn from_borrowed_ptr_or_err<T>(self, ptr: *mut ffi::PyObject) -> PyResult<&'p T>
where where
@ -428,10 +426,9 @@ impl<'p> Python<'p> {
FromPyPointer::from_borrowed_ptr_or_err(self, ptr) FromPyPointer::from_borrowed_ptr_or_err(self, ptr)
} }
/// Registers the borrowed object pointer in the release pool. /// Does an unchecked downcast to the specific type.
/// ///
/// Returns `None` if the pointer is NULL. /// Returns `None` if the pointer is NULL.
/// Does an unchecked downcast to the specific type.
#[allow(clippy::wrong_self_convention)] #[allow(clippy::wrong_self_convention)]
pub unsafe fn from_borrowed_ptr_or_opt<T>(self, ptr: *mut ffi::PyObject) -> Option<&'p T> pub unsafe fn from_borrowed_ptr_or_opt<T>(self, ptr: *mut ffi::PyObject) -> Option<&'p T>
where where