nautilus_model::python::data

Function drop_cvec_pycapsule

source
pub fn drop_cvec_pycapsule(capsule: &PyAny)
Expand description

Drops a PyCapsule containing a CVec structure.

This function safely extracts and drops the CVec instance encapsulated within a PyCapsule object. It is intended for cleaning up after the Data instances have been transferred into Python and are no longer needed.

§Panics

This function panics:

  • If the capsule cannot be downcast to a PyCapsule, indicating a type mismatch or improper capsule handling.

§Safety

This function is unsafe as it involves raw pointer dereferencing and manual memory management. The caller must ensure the PyCapsule contains a valid CVec pointer. Incorrect usage can lead to memory corruption or undefined behavior.