Function
try_magic_method
(
func_name: &'static PyStrInterned,
vm: &VirtualMachine,
value: &PyObject,
)
Source from the content-addressed store, hash-verified
| 344 | } |
| 345 | |
| 346 | fn try_magic_method( |
| 347 | func_name: &'static PyStrInterned, |
| 348 | vm: &VirtualMachine, |
| 349 | value: &PyObject, |
| 350 | ) -> PyResult { |
| 351 | let method = vm.get_method_or_type_error(value.to_owned(), func_name, || { |
| 352 | format!( |
| 353 | "type '{}' doesn't define '{}' method", |
| 354 | value.class().name(), |
| 355 | func_name.as_str(), |
| 356 | ) |
| 357 | })?; |
| 358 | method.call((), vm) |
| 359 | } |
| 360 | |
| 361 | #[pyfunction] |
| 362 | fn trunc(x: PyObjectRef, vm: &VirtualMachine) -> PyResult { |
Tested by
no test coverage detected