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

Function _current_exceptions

crates/vm/src/stdlib/sys.rs:1057–1069  ·  view source on GitHub ↗
(vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

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]

Callers

nothing calls this directly

Calls 8

new_dictMethod · 0.80
noneMethod · 0.80
topmost_exceptionMethod · 0.80
new_intMethod · 0.45
set_itemMethod · 0.45
as_objectMethod · 0.45
to_pyobjectMethod · 0.45

Tested by

no test coverage detected