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

Method tolist

crates/vm/src/builtins/memory.rs:719–730  ·  view source on GitHub ↗
(&self, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

717
718 #[pymethod]
719 fn tolist(&self, vm: &VirtualMachine) -> PyResult<PyListRef> {
720 self.try_not_released(vm)?;
721 let bytes = self.buffer.obj_bytes();
722 if self.desc.ndim() == 0 {
723 return Ok(vm.ctx.new_list(vec![format_unpack(
724 &self.format_spec,
725 &bytes[..self.desc.itemsize],
726 vm,
727 )?]));
728 }
729 self._to_list(&bytes, 0, 0, vm)
730 }
731
732 #[pymethod]
733 fn toreadonly(&self, vm: &VirtualMachine) -> PyResult<PyRef<Self>> {

Callers

nothing calls this directly

Calls 5

try_not_releasedMethod · 0.80
new_listMethod · 0.80
_to_listMethod · 0.80
obj_bytesMethod · 0.45
ndimMethod · 0.45

Tested by

no test coverage detected