Visitar URL original
Use vm.import · RustPython/RustPython@0fe9046 · GitHub
Skip to content

Commit 0fe9046

Browse files
committed
Use vm.import
1 parent 79629b0 commit 0fe9046

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎vm/src/import.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ pub fn init_importlib(vm: &VirtualMachine, external: bool) -> PyResult {
2626
vm.get_attribute(importlib.clone(), "_install_external_importers")?;
2727
vm.invoke(install_external, vec![])?;
2828
// Set pyc magic number to commit hash. Should be changed when bytecode will be more stable.
29-
let sys_modules = vm.get_attribute(vm.sys_module.clone(), "modules")?;
30-
let importlib_external = sys_modules.get_item("_frozen_importlib_external", vm)?;
29+
let importlib_external =
30+
vm.import("_frozen_importlib_external", &vm.ctx.new_tuple(vec![]), 0)?;
3131
let mut magic = get_git_revision().into_bytes();
3232
magic.truncate(4);
3333
if magic.len() != 4 {

0 commit comments

Comments
 (0)