(interp: &Interpreter)
| 3 | use vm::{Interpreter, builtins::PyStrRef}; |
| 4 | |
| 5 | fn py_main(interp: &Interpreter) -> vm::PyResult<PyStrRef> { |
| 6 | interp.enter(|vm| { |
| 7 | // Add local library path |
| 8 | vm.insert_sys_path(vm.new_pyobj("examples")) |
| 9 | .expect("add examples to sys.path failed"); |
| 10 | let module = vm.import("package_embed", 0)?; |
| 11 | let name_func = module.get_attr("context", vm)?; |
| 12 | let result = name_func.call((), vm)?; |
| 13 | let result: PyStrRef = result.get_attr("name", vm)?.try_into_value(vm)?; |
| 14 | vm::PyResult::Ok(result) |
| 15 | }) |
| 16 | } |
| 17 | |
| 18 | fn main() -> ExitCode { |
| 19 | // Add standard library path |
no test coverage detected