From 9f3e13ef4d23c96063a14c17b55f07121d889884 Mon Sep 17 00:00:00 2001 From: David Hewitt <1939362+davidhewitt@users.noreply.github.com> Date: Fri, 17 Jul 2020 18:18:36 +0100 Subject: [PATCH] Fix doc for PyType::from_type_ptr --- src/types/typeobject.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/types/typeobject.rs b/src/types/typeobject.rs index 5b80d39d..beeb2b77 100644 --- a/src/types/typeobject.rs +++ b/src/types/typeobject.rs @@ -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)