(&self, exc: PyBaseExceptionRef, msg: &str)
| 12 | #[track_caller] |
| 13 | #[cold] |
| 14 | fn _py_panic_failed(&self, exc: PyBaseExceptionRef, msg: &str) -> ! { |
| 15 | #[cfg(not(all( |
| 16 | target_arch = "wasm32", |
| 17 | not(any(target_os = "emscripten", target_os = "wasi")), |
| 18 | )))] |
| 19 | { |
| 20 | self.print_exception(exc); |
| 21 | self.flush_std(); |
| 22 | panic!("{msg}") |
| 23 | } |
| 24 | #[cfg(all( |
| 25 | target_arch = "wasm32", |
| 26 | feature = "wasmbind", |
| 27 | not(any(target_os = "emscripten", target_os = "wasi")), |
| 28 | ))] |
| 29 | #[cfg(all(target_arch = "wasm32", not(target_os = "wasi"), feature = "wasmbind"))] |
| 30 | { |
| 31 | use wasm_bindgen::prelude::*; |
| 32 | #[wasm_bindgen] |
| 33 | extern "C" { |
| 34 | #[wasm_bindgen(js_namespace = console)] |
| 35 | fn error(s: &str); |
| 36 | } |
| 37 | let mut s = String::new(); |
| 38 | self.write_exception(&mut s, &exc).unwrap(); |
| 39 | error(&s); |
| 40 | panic!("{msg}; exception backtrace above") |
| 41 | } |
| 42 | #[cfg(all( |
| 43 | target_arch = "wasm32", |
| 44 | not(feature = "wasmbind"), |
| 45 | not(any(target_os = "emscripten", target_os = "wasi")), |
| 46 | ))] |
| 47 | { |
| 48 | use crate::convert::ToPyObject; |
| 49 | let err_string: String = exc.to_pyobject(self).repr(self).unwrap().to_string(); |
| 50 | eprintln!("{err_string}"); |
| 51 | panic!("{msg}; python exception not available") |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | /// Returns true if the file object's `closed` attribute is truthy. |
| 56 | fn file_is_closed(&self, file: &PyObject) -> bool { |
no test coverage detected