(arg: PyObjectRef, vm: &VirtualMachine)
| 203 | } |
| 204 | |
| 205 | fn type_check(arg: PyObjectRef, vm: &VirtualMachine) -> PyResult<PyObjectRef> { |
| 206 | // Fast path to avoid calling into typing.py |
| 207 | if is_unionable(arg.clone(), vm) { |
| 208 | return Ok(arg); |
| 209 | } |
| 210 | let message_str: PyObjectRef = vm |
| 211 | .ctx |
| 212 | .new_str("Union[arg, ...]: each arg must be a type.") |
| 213 | .into(); |
| 214 | call_typing_func_object(vm, "_type_check", (arg, message_str)) |
| 215 | } |
| 216 | |
| 217 | fn has_union_operands(a: PyObjectRef, b: PyObjectRef, vm: &VirtualMachine) -> bool { |
| 218 | let union_type = vm.ctx.types.union_type; |
no test coverage detected