Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Add _imp._override_frozen_modules_for_tests
  • Loading branch information
youknowone committed Feb 23, 2023
commit 5e3046d86a7001cbcce7287626b1aef48ff397fc
5 changes: 5 additions & 0 deletions vm/src/stdlib/imp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ mod _imp {
.ok_or_else(|| vm.new_import_error(format!("No such frozen object named {name}"), name))
}

#[pyfunction]
fn _override_frozen_modules_for_tests(value: isize, vm: &VirtualMachine) {
vm.state.override_frozen_modules.store(value);
}

#[pyfunction]
fn _fix_co_filename(_code: PyObjectRef, _path: PyStrRef) {
// TODO:
Expand Down
2 changes: 2 additions & 0 deletions vm/src/vm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ pub struct PyGlobalState {
pub codec_registry: CodecsRegistry,
pub finalizing: AtomicBool,
pub warnings: WarningsState,
pub override_frozen_modules: AtomicCell<isize>,
}

pub fn process_hash_secret_seed() -> u32 {
Expand Down Expand Up @@ -172,6 +173,7 @@ impl VirtualMachine {
codec_registry,
finalizing: AtomicBool::new(false),
warnings,
override_frozen_modules: AtomicCell::new(0),
}),
initialized: false,
recursion_depth: Cell::new(0),
Expand Down