MCPcopy Index your code
hub / github.com/RustPython/RustPython / iobase_close

Function iobase_close

crates/vm/src/stdlib/_io.rs:625–632  ·  view source on GitHub ↗
(file: &PyObject, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

623 }
624
625 pub(super) fn iobase_close(file: &PyObject, vm: &VirtualMachine) -> PyResult<()> {
626 if !file_closed(file, vm)? {
627 let res = vm.call_method(file, "flush", ());
628 file.set_attr("__closed", vm.new_pyobj(true), vm)?;
629 res?;
630 }
631 Ok(())
632 }
633
634 #[pyattr]
635 #[pyclass(name = "_RawIOBase", base = _IOBase)]

Callers 1

closeMethod · 0.85

Calls 4

file_closedFunction · 0.85
new_pyobjMethod · 0.80
call_methodMethod · 0.45
set_attrMethod · 0.45

Tested by

no test coverage detected