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

Function remove_importlib_frames

crates/vm/src/import.rs:250–261  ·  view source on GitHub ↗

TODO: This function should do nothing on verbose mode. TODO: Fix this function after making PyTraceback.next mutable

(vm: &VirtualMachine, exc: &Py<PyBaseException>)

Source from the content-addressed store, hash-verified

248// TODO: This function should do nothing on verbose mode.
249// TODO: Fix this function after making PyTraceback.next mutable
250pub fn remove_importlib_frames(vm: &VirtualMachine, exc: &Py<PyBaseException>) {
251 if vm.state.config.settings.verbose != 0 {
252 return;
253 }
254
255 let always_trim = exc.fast_isinstance(vm.ctx.exceptions.import_error);
256
257 if let Some(tb) = exc.__traceback__() {
258 let trimmed_tb = remove_importlib_frames_inner(vm, Some(tb), always_trim).0;
259 exc.set_traceback_typed(trimmed_tb);
260 }
261}
262
263/// Get origin path from a module spec, checking has_location first.
264pub(crate) fn get_spec_file_origin(

Callers 1

import_innerMethod · 0.85

Calls 5

fast_isinstanceMethod · 0.80
__traceback__Method · 0.80
set_traceback_typedMethod · 0.80
SomeClass · 0.50

Tested by

no test coverage detected