Get cell contents by localsplus index.
(&self, localsplus_idx: usize)
| 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. |
no test coverage detected