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

Method slot_str

crates/vm/src/builtins/bytes.rs:228–232  ·  view source on GitHub ↗
(zelf: &PyObject, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

226
227 #[pyslot]
228 fn slot_str(zelf: &PyObject, vm: &VirtualMachine) -> PyResult<PyStrRef> {
229 let zelf = zelf.downcast_ref::<Self>().expect("expected bytes");
230 PyBytesInner::warn_on_str("str() on a bytes instance", vm)?;
231 Ok(vm.ctx.new_str(zelf.inner.repr_bytes(vm)?))
232 }
233
234 fn __add__(&self, other: ArgBytesLike) -> Vec<u8> {
235 self.inner.add(&other.borrow_buf())

Callers

nothing calls this directly

Calls 2

repr_bytesMethod · 0.80
new_strMethod · 0.45

Tested by

no test coverage detected