(&self)
| 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 |