(&self)
| 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 { |
no test coverage detected