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

Method clear_stack_and_cells

crates/vm/src/frame.rs:783–789  ·  view source on GitHub ↗

Clear evaluation stack and state-owned cell/free references. For full local/cell cleanup, call `clear_locals_and_stack()`.

(&self)

Source from the content-addressed store, hash-verified

781 /// Clear evaluation stack and state-owned cell/free references.
782 /// For full local/cell cleanup, call `clear_locals_and_stack()`.
783 pub(crate) fn clear_stack_and_cells(&self) {
784 // SAFETY: Called when frame is not executing (generator closed).
785 // Cell refs in fastlocals[nlocals..] are cleared by clear_locals_and_stack().
786 unsafe {
787 (*self.iframe.get()).localsplus.stack_clear();
788 }
789 }
790
791 /// Clear locals and stack after generator/coroutine close.
792 /// Releases references held by the frame, matching _PyFrame_ClearLocals.

Callers 2

clearMethod · 0.80

Calls 2

stack_clearMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected