pub unsafe fn cast_function_argument<'py>(
py: Python<'py>,
raw_arg: *mut PyObject,
) -> Borrowed<'py, 'py, PyAny>Expand description
Cast a raw *mut ffi::PyObject to a PyArg. This is used to access safer PyO3
APIs with the assumption that the borrowed argument is valid for the lifetime 'py.
This has the effect of limiting the lifetime of function arguments to 'py, i.e.
avoiding accidentally creating 'static lifetimes from raw pointers.
§Safety
raw_argmust be a valid*mut ffi::PyObjectfor the lifetime'py.raw_argmust not be NULL.