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

Function value_from_object

crates/vm/src/byte.rs:20–25  ·  view source on GitHub ↗
(vm: &VirtualMachine, obj: &PyObject)

Source from the content-addressed store, hash-verified

18}
19
20pub fn value_from_object(vm: &VirtualMachine, obj: &PyObject) -> PyResult<u8> {
21 obj.try_index(vm)?
22 .as_bigint()
23 .to_u8()
24 .ok_or_else(|| vm.new_value_error("byte must be in range(0, 256)"))
25}

Callers 7

write_byteMethod · 0.85
setitem_by_indexMethod · 0.85
bytes_from_objectFunction · 0.85
_setitem_by_indexMethod · 0.85
insertMethod · 0.85
appendMethod · 0.85
removeMethod · 0.85

Calls 3

ok_or_elseMethod · 0.80
as_bigintMethod · 0.80
try_indexMethod · 0.80

Tested by

no test coverage detected