(
vm: &VirtualMachine,
element: Option<&PyObject>,
)
| 207 | } |
| 208 | |
| 209 | fn try_update_quantity_from_element( |
| 210 | vm: &VirtualMachine, |
| 211 | element: Option<&PyObject>, |
| 212 | ) -> PyResult<CFormatQuantity> { |
| 213 | match element { |
| 214 | Some(width_obj) => { |
| 215 | if let Some(i) = width_obj.downcast_ref::<PyInt>() { |
| 216 | let i = i.try_to_primitive::<i32>(vm)?.unsigned_abs(); |
| 217 | Ok(CFormatQuantity::Amount(i as usize)) |
| 218 | } else { |
| 219 | Err(vm.new_type_error("* wants int")) |
| 220 | } |
| 221 | } |
| 222 | None => Err(vm.new_type_error("not enough arguments for format string")), |
| 223 | } |
| 224 | } |
| 225 | |
| 226 | fn try_conversion_flag_from_tuple( |
| 227 | vm: &VirtualMachine, |
no test coverage detected