(vm: &VirtualMachine)
| 1055 | #[cfg(feature = "threading")] |
| 1056 | #[pyfunction] |
| 1057 | fn _current_exceptions(vm: &VirtualMachine) -> PyResult<PyDictRef> { |
| 1058 | use crate::AsObject; |
| 1059 | use crate::vm::thread::get_all_current_exceptions; |
| 1060 | |
| 1061 | let dict = vm.ctx.new_dict(); |
| 1062 | for (thread_id, exc) in get_all_current_exceptions(vm) { |
| 1063 | let key = vm.ctx.new_int(thread_id); |
| 1064 | let value = exc.map_or_else(|| vm.ctx.none(), |e| e.into()); |
| 1065 | dict.set_item(key.as_object(), value, vm)?; |
| 1066 | } |
| 1067 | |
| 1068 | Ok(dict) |
| 1069 | } |
| 1070 | |
| 1071 | #[cfg(not(feature = "threading"))] |
| 1072 | #[pyfunction] |
nothing calls this directly
no test coverage detected