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

Method get_cell_contents

crates/vm/src/frame.rs:803–811  ·  view source on GitHub ↗

Get cell contents by localsplus index.

(&self, localsplus_idx: usize)

Source from the content-addressed store, hash-verified

801
802 /// Get cell contents by localsplus index.
803 pub(crate) fn get_cell_contents(&self, localsplus_idx: usize) -> Option<PyObjectRef> {
804 // SAFETY: Frame not executing; no concurrent mutation.
805 let fastlocals = unsafe { (*self.iframe.get()).localsplus.fastlocals() };
806 fastlocals
807 .get(localsplus_idx)
808 .and_then(|slot| slot.as_ref())
809 .and_then(|obj| obj.downcast_ref::<PyCell>())
810 .and_then(|cell| cell.get())
811 }
812
813 /// Store a borrowed back-reference to the owning generator/coroutine.
814 /// The caller must ensure the generator outlives the frame.

Callers 1

initMethod · 0.80

Calls 3

fastlocalsMethod · 0.80
getMethod · 0.45
as_refMethod · 0.45

Tested by

no test coverage detected