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

Method flush_std

crates/vm/src/vm/vm_object.rs:62–80  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

60 }
61
62 pub(crate) fn flush_std(&self) -> i32 {
63 let vm = self;
64 let mut status = 0;
65 if let Ok(stdout) = sys::get_stdout(vm)
66 && !vm.is_none(&stdout)
67 && !vm.file_is_closed(&stdout)
68 && let Err(e) = vm.call_method(&stdout, identifier!(vm, flush).as_str(), ())
69 {
70 vm.run_unraisable(e, None, stdout);
71 status = -1;
72 }
73 if let Ok(stderr) = sys::get_stderr(vm)
74 && !vm.is_none(&stderr)
75 && !vm.file_is_closed(&stderr)
76 {
77 let _ = vm.call_method(&stderr, identifier!(vm, flush).as_str(), ());
78 }
79 status
80 }
81
82 #[track_caller]
83 pub fn unwrap_pyresult<T>(&self, result: PyResult<T>) -> T {

Callers 3

handle_exit_exceptionMethod · 0.80
_py_panic_failedMethod · 0.80
finalizeMethod · 0.80

Calls 7

get_stdoutFunction · 0.85
get_stderrFunction · 0.85
file_is_closedMethod · 0.80
run_unraisableMethod · 0.80
is_noneMethod · 0.45
call_methodMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected