(obj: PyObjectRef, vm: &VirtualMachine)
| 1532 | } |
| 1533 | |
| 1534 | pub fn get_offset(obj: PyObjectRef, vm: &VirtualMachine) -> PyResult<Offset> { |
| 1535 | let int = obj.try_index(vm)?; |
| 1536 | int.as_bigint().try_into().map_err(|_| { |
| 1537 | vm.new_value_error(format!( |
| 1538 | "cannot fit '{}' into an offset-sized integer", |
| 1539 | obj.class().name() |
| 1540 | )) |
| 1541 | }) |
| 1542 | } |
| 1543 | |
| 1544 | pub fn repr_file_obj_name(obj: &PyObject, vm: &VirtualMachine) -> PyResult<Option<PyStrRef>> { |
| 1545 | let name = match obj.get_attr("name", vm) { |