Method
__instancecheck__
(
zelf: PyRef<Self>,
obj: PyObjectRef,
vm: &VirtualMachine,
)
Source from the content-addressed store, hash-verified
| 129 | |
| 130 | #[pymethod] |
| 131 | fn __instancecheck__( |
| 132 | zelf: PyRef<Self>, |
| 133 | obj: PyObjectRef, |
| 134 | vm: &VirtualMachine, |
| 135 | ) -> PyResult<bool> { |
| 136 | if zelf |
| 137 | .args |
| 138 | .iter() |
| 139 | .any(|x| x.class().is(vm.ctx.types.generic_alias_type)) |
| 140 | { |
| 141 | Err(vm.new_type_error("isinstance() argument 2 cannot be a parameterized generic")) |
| 142 | } else { |
| 143 | obj.is_instance(zelf.__args__().as_object(), vm) |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | #[pymethod] |
| 148 | fn __subclasscheck__( |
Callers
nothing calls this directly
Tested by
no test coverage detected