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

Method try_from_object

crates/stdlib/src/select.rs:129–139  ·  view source on GitHub ↗
(vm: &VirtualMachine, obj: PyObjectRef)

Source from the content-addressed store, hash-verified

127
128impl TryFromObject for Selectable {
129 fn try_from_object(vm: &VirtualMachine, obj: PyObjectRef) -> PyResult<Self> {
130 let fno = obj.try_to_value(vm).or_else(|_| {
131 let meth = vm.get_method_or_type_error(
132 obj.clone(),
133 vm.ctx.interned_str("fileno").unwrap(),
134 || "select arg must be an int or object with a fileno() method".to_owned(),
135 )?;
136 meth.call((), vm)?.try_into_value(vm)
137 })?;
138 Ok(Self { obj, fno })
139 }
140}
141
142// Keep it in a MaybeUninit, since on windows FD_ZERO doesn't actually zero the whole thing

Callers

nothing calls this directly

Calls 15

SelfFunction · 0.85
try_to_valueMethod · 0.80
interned_strMethod · 0.80
try_into_valueMethod · 0.80
to_f64Method · 0.80
try_index_optMethod · 0.80
as_bigintMethod · 0.80
ok_or_elseMethod · 0.80
ErrClass · 0.50
SomeClass · 0.50
cloneMethod · 0.45

Tested by

no test coverage detected