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

Method bytes

crates/vm/src/protocol/object.rs:34–43  ·  view source on GitHub ↗
(self, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

32 }
33
34 pub fn bytes(self, vm: &VirtualMachine) -> PyResult {
35 let bytes_type = vm.ctx.types.bytes_type;
36 match self.downcast_exact::<PyInt>(vm) {
37 Ok(int) => Err(vm.new_downcast_type_error(bytes_type, &int)),
38 Err(obj) => {
39 let args = FuncArgs::from(vec![obj]);
40 <PyBytes as Constructor>::slot_new(bytes_type.to_owned(), args, vm)
41 }
42 }
43 }
44
45 // const hash_not_implemented: fn(&PyObject, &VirtualMachine) ->PyResult<PyHash> = crate::types::Unhashable::slot_hash;
46

Callers 9

handle_encode_errorMethod · 0.45
compute_modeFunction · 0.45
initMethod · 0.45
__bytes__Method · 0.45
line_number_atFunction · 0.45
unparse_exprMethod · 0.45
expr_constantMethod · 0.45

Calls 3

ErrClass · 0.50
to_ownedMethod · 0.45

Tested by

no test coverage detected