(
vm: &VirtualMachine,
obj: &PyObject,
field: &'static str,
)
| 176 | } |
| 177 | |
| 178 | fn get_opt_int_field( |
| 179 | vm: &VirtualMachine, |
| 180 | obj: &PyObject, |
| 181 | field: &'static str, |
| 182 | ) -> PyResult<Option<PyRefExact<PyInt>>> { |
| 183 | match get_node_field_opt(vm, obj, field)? { |
| 184 | Some(val) => val |
| 185 | .downcast_exact(vm) |
| 186 | .map(Some) |
| 187 | .map_err(|_| vm.new_type_error(format!(r#"field "{field}" must have integer type"#))), |
| 188 | None => Ok(None), |
| 189 | } |
| 190 | } |
| 191 | |
| 192 | fn range_from_object( |
| 193 | vm: &VirtualMachine, |
no test coverage detected