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

Method to_pyexception

crates/vm/src/stdlib/_imp.rs:124–135  ·  view source on GitHub ↗
(&self, mod_name: &str, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

122
123impl FrozenError {
124 fn to_pyexception(&self, mod_name: &str, vm: &VirtualMachine) -> PyBaseExceptionRef {
125 use FrozenError::*;
126 let msg = match self {
127 BadName | NotFound => format!("No such frozen object named {mod_name}"),
128 Disabled => format!(
129 "Frozen modules are disabled and the frozen object named {mod_name} is not essential"
130 ),
131 Excluded => format!("Excluded frozen object named {mod_name}"),
132 Invalid => format!("Frozen object named {mod_name} is invalid"),
133 };
134 vm.new_import_error(msg, vm.ctx.new_utf8_str(mod_name))
135 }
136}
137
138// look_up_frozen + use_frozen in import.c

Callers 15

formatter_parserFunction · 0.45
is_frozen_packageFunction · 0.45
find_frozenFunction · 0.45
set_inheritableFunction · 0.45
fchmod_implFunction · 0.45
_path_isdevdriveFunction · 0.45
get_terminal_sizeFunction · 0.45
spawnveFunction · 0.45
execvFunction · 0.45
execveFunction · 0.45
_getdiskusageFunction · 0.45

Calls 2

new_import_errorMethod · 0.80
new_utf8_strMethod · 0.80

Tested by

no test coverage detected