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

Method stack_try_push

crates/vm/src/frame.rs:312–321  ·  view source on GitHub ↗
(&mut self, val: Option<PyStackRef>)

Source from the content-addressed store, hash-verified

310 /// Try to push; returns Err if stack is full.
311 #[inline(always)]
312 fn stack_try_push(&mut self, val: Option<PyStackRef>) -> Result<(), Option<PyStackRef>> {
313 let idx = self.nlocalsplus as usize + self.stack_top as usize;
314 if idx >= self.capacity() {
315 return Err(val);
316 }
317 let data = self.data_as_mut_slice();
318 data[idx] = unsafe { core::mem::transmute::<Option<PyStackRef>, usize>(val) };
319 self.stack_top += 1;
320 Ok(())
321 }
322
323 /// Pop a value from the evaluation stack.
324 #[inline(always)]

Callers 1

push_stackref_optMethod · 0.80

Calls 3

data_as_mut_sliceMethod · 0.80
ErrClass · 0.50
capacityMethod · 0.45

Tested by

no test coverage detected