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

Method try_from_borrowed_object

crates/vm/src/function/buffer.rs:79–86  ·  view source on GitHub ↗
(vm: &VirtualMachine, obj: &'a PyObject)

Source from the content-addressed store, hash-verified

77
78impl<'a> TryFromBorrowedObject<'a> for ArgBytesLike {
79 fn try_from_borrowed_object(vm: &VirtualMachine, obj: &'a PyObject) -> PyResult<Self> {
80 let buffer = PyBuffer::try_from_borrowed_object(vm, obj)?;
81 if buffer.desc.is_contiguous() {
82 Ok(Self(buffer))
83 } else {
84 Err(vm.new_buffer_error("non-contiguous buffer is not a bytes-like object"))
85 }
86 }
87}
88
89/// A memory buffer, read-write access. Like the `w*` format code for `PyArg_Parse` in CPython.

Callers

nothing calls this directly

Calls 3

SelfFunction · 0.85
is_contiguousMethod · 0.80
ErrClass · 0.50

Tested by

no test coverage detected