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

Method check

crates/vm/src/convert/transmute_from.rs:17–28  ·  view source on GitHub ↗
(vm: &VirtualMachine, obj: &PyObject)

Source from the content-addressed store, hash-verified

15
16unsafe impl<T: PyPayload> TransmuteFromObject for PyRef<T> {
17 fn check(vm: &VirtualMachine, obj: &PyObject) -> PyResult<()> {
18 let class = T::class(&vm.ctx);
19 if obj.fast_isinstance(class) {
20 if obj.downcastable::<T>() {
21 Ok(())
22 } else {
23 Err(vm.new_downcast_runtime_error(class, obj))
24 }
25 } else {
26 Err(vm.new_downcast_type_error(class, obj))
27 }
28 }
29}

Callers

nothing calls this directly

Calls 4

fast_isinstanceMethod · 0.80
ErrClass · 0.50

Tested by

no test coverage detected