mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-09 22:49:57 +09:00
Use vm.import
This commit is contained in:
@@ -26,8 +26,8 @@ pub fn init_importlib(vm: &VirtualMachine, external: bool) -> PyResult {
|
||||
vm.get_attribute(importlib.clone(), "_install_external_importers")?;
|
||||
vm.invoke(install_external, vec![])?;
|
||||
// Set pyc magic number to commit hash. Should be changed when bytecode will be more stable.
|
||||
let sys_modules = vm.get_attribute(vm.sys_module.clone(), "modules")?;
|
||||
let importlib_external = sys_modules.get_item("_frozen_importlib_external", vm)?;
|
||||
let importlib_external =
|
||||
vm.import("_frozen_importlib_external", &vm.ctx.new_tuple(vec![]), 0)?;
|
||||
let mut magic = get_git_revision().into_bytes();
|
||||
magic.truncate(4);
|
||||
if magic.len() != 4 {
|
||||
|
||||
Reference in New Issue
Block a user