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

Method clear_locals_and_stack

crates/vm/src/frame.rs:793–800  ·  view source on GitHub ↗

Clear locals and stack after generator/coroutine close. Releases references held by the frame, matching _PyFrame_ClearLocals.

(&self)

Source from the content-addressed store, hash-verified

791 /// Clear locals and stack after generator/coroutine close.
792 /// Releases references held by the frame, matching _PyFrame_ClearLocals.
793 pub(crate) fn clear_locals_and_stack(&self) {
794 self.clear_stack_and_cells();
795 // SAFETY: Frame is not executing (generator closed).
796 let fastlocals = unsafe { (*self.iframe.get()).localsplus.fastlocals_mut() };
797 for slot in fastlocals.iter_mut() {
798 *slot = None;
799 }
800 }
801
802 /// Get cell contents by localsplus index.
803 pub(crate) fn get_cell_contents(&self, localsplus_idx: usize) -> Option<PyObjectRef> {

Callers 1

closeMethod · 0.80

Calls 4

clear_stack_and_cellsMethod · 0.80
fastlocals_mutMethod · 0.80
getMethod · 0.45
iter_mutMethod · 0.45

Tested by

no test coverage detected