pyo3::impl_::pymethods

Function call_super_traverse

Source
unsafe fn call_super_traverse(
    obj: *mut PyObject,
    visit: visitproc,
    arg: *mut c_void,
    current_traverse: traverseproc,
) -> c_int
Expand description

Call super-type traverse method, if necessary.

Adapted from https://github.com/cython/cython/blob/7acfb375fb54a033f021b0982a3cd40c34fb22ac/Cython/Utility/ExtensionTypes.c#L386

TODO: There are possible optimizations over looking up the base type in this way

  • if the base type is known in this module, can potentially look it up directly in module state (when we have it)
  • if the base type is a Python builtin, can jut call the C function directly
  • if the base type is a PyO3 type defined in the same module, can potentially do similar to tp_alloc where we solve this at compile time
⚠️ Internal Docs ⚠️ Not Public API 👉 Official Docs Here