Clear locals and stack after generator/coroutine close. Releases references held by the frame, matching _PyFrame_ClearLocals.
(&self)
| 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> { |
no test coverage detected