MCPcopy Index your code
hub / github.com/RustPython/RustPython / gc_get_referent_ptrs

Method gc_get_referent_ptrs

crates/vm/src/object/core.rs:1734–1741  ·  view source on GitHub ↗

Get raw pointers to referents without incrementing reference counts. This is used during GC to avoid reference count manipulation. tp_traverse visits objects without incref # Safety The returned pointers are only valid as long as the object is alive and its contents haven't been modified.

(&self)

Source from the content-addressed store, hash-verified

1732 /// The returned pointers are only valid as long as the object is alive
1733 /// and its contents haven't been modified.
1734 pub unsafe fn gc_get_referent_ptrs(&self) -> Vec<NonNull<PyObject>> {
1735 let mut result = Vec::new();
1736 // Traverse the entire object including dict and slots
1737 self.0.traverse(&mut |child: &PyObject| {
1738 result.push(NonNull::from(child));
1739 });
1740 result
1741 }
1742
1743 /// Pop edges from this object for cycle breaking.
1744 /// Returns extracted child references that were removed from this object (tp_clear).

Callers 2

collect_innerMethod · 0.80
get_referrersFunction · 0.80

Calls 3

newFunction · 0.85
traverseMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected