(
zelf: PyRef<Self>,
pos: OptionalOption<PyObjectRef>,
vm: &VirtualMachine,
)
| 1681 | |
| 1682 | #[pymethod] |
| 1683 | fn truncate( |
| 1684 | zelf: PyRef<Self>, |
| 1685 | pos: OptionalOption<PyObjectRef>, |
| 1686 | vm: &VirtualMachine, |
| 1687 | ) -> PyResult { |
| 1688 | let pos = pos.flatten().to_pyobject(vm); |
| 1689 | let mut data = zelf.lock(vm)?; |
| 1690 | data.check_init(vm)?; |
| 1691 | if !data.writable() { |
| 1692 | return Err(new_unsupported_operation(vm, "truncate".to_owned())); |
| 1693 | } |
| 1694 | data.flush_rewind(vm)?; |
| 1695 | let res = vm.call_method(data.raw.as_ref().unwrap(), "truncate", (pos,))?; |
| 1696 | let _ = data.raw_tell(vm); |
| 1697 | Ok(res) |
| 1698 | } |
| 1699 | #[pymethod] |
| 1700 | fn detach(zelf: PyRef<Self>, vm: &VirtualMachine) -> PyResult { |
| 1701 | vm.call_method(zelf.as_object(), "flush", ())?; |
nothing calls this directly
no test coverage detected