Visitar URL original
Write bytecode by palaviv · Pull Request #1166 · RustPython/RustPython · GitHub
Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Use vm.import
  • Loading branch information
palaviv committed Jul 24, 2019
commit dde40a4b1c38246932721bd917d56dce87946df4
4 changes: 2 additions & 2 deletions vm/src/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down