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

Method try_from_object

crates/vm/src/builtins/set.rs:1339–1348  ·  view source on GitHub ↗
(vm: &VirtualMachine, obj: PyObjectRef)

Source from the content-addressed store, hash-verified

1337
1338impl TryFromObject for AnySet {
1339 fn try_from_object(vm: &VirtualMachine, obj: PyObjectRef) -> PyResult<Self> {
1340 let class = obj.class();
1341 if class.fast_issubclass(vm.ctx.types.set_type)
1342 || class.fast_issubclass(vm.ctx.types.frozenset_type)
1343 {
1344 Ok(Self { object: obj })
1345 } else {
1346 Err(vm.new_type_error(format!("{class} is not a subtype of set or frozenset")))
1347 }
1348 }
1349}
1350
1351#[pyclass(module = false, name = "set_iterator")]

Callers

nothing calls this directly

Calls 3

fast_issubclassMethod · 0.80
ErrClass · 0.50
classMethod · 0.45

Tested by

no test coverage detected