Skip to content

Commit

Permalink
Merge pull request #1048 from davidhewitt/fix-from-type-ptr-doc
Browse files Browse the repository at this point in the history
Fix doc for PyType::from_type_ptr
  • Loading branch information
davidhewitt authored Jul 18, 2020
2 parents 8bbdbc4 + 9f3e13e commit 264e885
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/types/typeobject.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ impl PyType {
}

/// Retrieves the `PyType` instance for the given FFI pointer.
/// This increments the reference count on the type object.
/// Undefined behavior if the pointer is NULL or invalid.
///
/// # Safety
/// - The pointer must be non-null.
/// - The pointer must be valid for the entire of the lifetime for which the reference is used.
#[inline]
pub unsafe fn from_type_ptr(py: Python, p: *mut ffi::PyTypeObject) -> &PyType {
py.from_borrowed_ptr(p as *mut ffi::PyObject)
Expand Down

0 comments on commit 264e885

Please sign in to comment.