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

Method __subclasscheck__

crates/vm/src/builtins/union.rs:148–162  ·  view source on GitHub ↗
(
        zelf: PyRef<Self>,
        obj: PyObjectRef,
        vm: &VirtualMachine,
    )

Source from the content-addressed store, hash-verified

146
147 #[pymethod]
148 fn __subclasscheck__(
149 zelf: PyRef<Self>,
150 obj: PyObjectRef,
151 vm: &VirtualMachine,
152 ) -> PyResult<bool> {
153 if zelf
154 .args
155 .iter()
156 .any(|x| x.class().is(vm.ctx.types.generic_alias_type))
157 {
158 Err(vm.new_type_error("issubclass() argument 2 cannot be a parameterized generic"))
159 } else {
160 obj.is_subclass(zelf.__args__().as_object(), vm)
161 }
162 }
163
164 fn __or__(zelf: PyObjectRef, other: PyObjectRef, vm: &VirtualMachine) -> PyResult {
165 type_::or_(zelf, other, vm)

Callers

nothing calls this directly

Calls 7

isMethod · 0.80
is_subclassMethod · 0.80
ErrClass · 0.50
iterMethod · 0.45
classMethod · 0.45
as_objectMethod · 0.45
__args__Method · 0.45

Tested by

no test coverage detected