(obj: PyObjectRef, vm: &VirtualMachine)
| 194 | } |
| 195 | |
| 196 | fn is_unionable(obj: PyObjectRef, vm: &VirtualMachine) -> bool { |
| 197 | let cls = obj.class(); |
| 198 | cls.is(vm.ctx.types.none_type) |
| 199 | || obj.downcastable::<PyType>() |
| 200 | || cls.fast_issubclass(vm.ctx.types.generic_alias_type) |
| 201 | || cls.is(vm.ctx.types.union_type) |
| 202 | || obj.downcast_ref::<TypeAliasType>().is_some() |
| 203 | } |
| 204 | |
| 205 | fn type_check(arg: PyObjectRef, vm: &VirtualMachine) -> PyResult<PyObjectRef> { |
| 206 | // Fast path to avoid calling into typing.py |
no test coverage detected