panic for not process-unique hash seed

This commit is contained in:
Jeong Yunwon
2022-05-17 06:03:20 +09:00
parent 7105073c91
commit 0f2e879d69

View File

@@ -163,6 +163,16 @@ impl VirtualMachine {
recursion_depth: Cell::new(0),
};
if vm.state.hash_secret.hash_str("")
!= vm
.ctx
.interned_str("")
.expect("empty str must be interned")
.hash(&vm)
{
panic!("Interpreters in same process must share the hash seed");
}
let frozen = frozen::get_module_inits().collect();
PyRc::get_mut(&mut vm.state).unwrap().frozen = frozen;