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

Method new_scope_with_main

crates/vm/src/vm/vm_new.rs:66–77  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

64 }
65
66 pub fn new_scope_with_main(&self) -> PyResult<Scope> {
67 let scope = self.new_scope_with_builtins();
68 let main_module = self.new_module("__main__", scope.globals.clone(), None);
69
70 self.sys_module.get_attr("modules", self)?.set_item(
71 "__main__",
72 main_module.into(),
73 self,
74 )?;
75
76 Ok(scope)
77 }
78
79 pub fn new_function<F, FKind>(&self, name: &'static str, f: F) -> PyRef<PyNativeFunction>
80 where

Callers 2

run_rustpythonFunction · 0.80
test_run_scriptFunction · 0.80

Calls 5

new_moduleMethod · 0.45
cloneMethod · 0.45
set_itemMethod · 0.45
get_attrMethod · 0.45

Tested by 1

test_run_scriptFunction · 0.64