(num: PyNumber<'_>, vm: &VirtualMachine)
| 561 | } |
| 562 | |
| 563 | fn bool_wrapper(num: PyNumber<'_>, vm: &VirtualMachine) -> PyResult<bool> { |
| 564 | let result = vm.call_special_method(num.obj, identifier!(vm, __bool__), ())?; |
| 565 | // __bool__ must return exactly bool, not int subclass |
| 566 | if !result.class().is(vm.ctx.types.bool_type) { |
| 567 | return Err(vm.new_type_error(format!( |
| 568 | "__bool__ should return bool, returned {}", |
| 569 | result.class().name() |
| 570 | ))); |
| 571 | } |
| 572 | Ok(crate::builtins::bool_::get_value(&result)) |
| 573 | } |
| 574 | |
| 575 | // PyObject_SelfIter in CPython |
| 576 | const fn self_iter(zelf: PyObjectRef, _vm: &VirtualMachine) -> PyResult { |
nothing calls this directly
no test coverage detected