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

Method finalize_clear_modules_dict

crates/vm/src/vm/mod.rs:1351–1357  ·  view source on GitHub ↗

Phase 3: Clear sys.modules dict.

(&self)

Source from the content-addressed store, hash-verified

1349
1350 /// Phase 3: Clear sys.modules dict.
1351 fn finalize_clear_modules_dict(&self) {
1352 if let Ok(modules) = self.sys_module.get_attr(identifier!(self, modules), self)
1353 && let Some(modules_dict) = modules.downcast_ref::<PyDict>()
1354 {
1355 modules_dict.clear();
1356 }
1357 }
1358
1359 /// Phase 5: Clear module dicts in reverse import order.
1360 /// Skip builtins and sys — those are cleared last in Phase 7.

Callers 1

finalize_modulesMethod · 0.80

Calls 2

get_attrMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected