MCPcopy Create free account
hub / github.com/PyO3/pyo3 / PyCFunction_GET_SELF

Function PyCFunction_GET_SELF

pyo3-ffi/src/cpython/methodobject.rs:37–46  ·  view source on GitHub ↗
(func: *mut PyObject)

Source from the content-addressed store, hash-verified

35#[cfg(not(GraalPy))]
36#[inline]
37pub unsafe fn PyCFunction_GET_SELF(func: *mut PyObject) -> *mut PyObject {
38 debug_assert_eq!(PyCMethod_Check(func), 1);
39
40 let func = func.cast::<PyCFunctionObject>();
41 if (*(*func).m_ml).ml_flags & METH_STATIC != 0 {
42 core::ptr::null_mut()
43 } else {
44 (*func).m_self
45 }
46}
47
48#[cfg(not(GraalPy))]
49#[inline]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected