We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 054bc72 commit fc0aa0cCopy full SHA for fc0aa0c
vm/src/import.rs
@@ -1,6 +1,7 @@
1
/*
2
* Import mechanics
3
*/
4
+use rand::Rng;
5
6
use crate::bytecode::CodeObject;
7
use crate::obj::{objcode, objsequence, objstr, objtype};
@@ -29,6 +30,9 @@ pub fn init_importlib(vm: &VirtualMachine, external: bool) -> PyResult {
29
30
let importlib_external = sys_modules.get_item("_frozen_importlib_external", vm)?;
31
let mut magic = get_git_revision().into_bytes();
32
magic.truncate(4);
33
+ if magic.len() != 4 {
34
+ magic = rand::thread_rng().gen::<[u8; 4]>().to_vec();
35
+ }
36
vm.set_attr(&importlib_external, "MAGIC_NUMBER", vm.ctx.new_bytes(magic))?;
37
}
38
Ok(vm.get_none())
0 commit comments