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

Method try_from_object

crates/vm/src/function/protocol.rs:58–66  ·  view source on GitHub ↗
(vm: &VirtualMachine, obj: PyObjectRef)

Source from the content-addressed store, hash-verified

56
57impl TryFromObject for ArgCallable {
58 fn try_from_object(vm: &VirtualMachine, obj: PyObjectRef) -> PyResult<Self> {
59 let Some(callable) = obj.to_callable() else {
60 return Err(
61 vm.new_type_error(format!("'{}' object is not callable", obj.class().name()))
62 );
63 };
64 let call = callable.call;
65 Ok(Self { obj, call })
66 }
67}
68
69/// An iterable Python object.

Callers

nothing calls this directly

Calls 9

to_callableMethod · 0.80
try_mappingMethod · 0.80
try_to_valueMethod · 0.80
ErrClass · 0.50
classMethod · 0.45
loadMethod · 0.45
is_noneMethod · 0.45
has_attrMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected