pub fn new(settings: PySettings) -> VirtualMachine {
        flame_guard!("init VirtualMachine");
        let ctx = PyContext::new();

        // make a new module without access to the vm; doesn't
        // set __spec__, __loader__, etc. attributes
        let new_module =
            |dict| PyObject::new(PyModule {}, ctx.types.module_type.clone(), Some(dict));

        // Hard-core modules:
        let builtins_dict = ctx.new_dict();
        let builtins = new_module(builtins_dict.clone());
        let sysmod_dict = ctx.new_dict();
        let sysmod = new_module(sysmod_dict.clone());

        let stdlib_inits = RefCell::new(stdlib::get_module_inits());
        let frozen = RefCell::new(frozen::get_module_inits());
        let import_func = RefCell::new(ctx.none());
        let profile_func = RefCell::new(ctx.none());
        let trace_func = RefCell::new(ctx.none());
        let signal_handlers = RefCell::new(arr![ctx.none(); 64]);

        let vm = VirtualMachine {
            builtins: builtins.clone(),
            sys_module: sysmod.clone(),
            stdlib_inits,
            ctx,
            frames: RefCell::new(vec![]),
            wasm_id: None,
            exceptions: RefCell::new(vec![]),
            frozen,
            import_func,
            profile_func,
            trace_func,
            use_tracing: RefCell::new(false),
            signal_handlers,
            settings,
            recursion_limit: Cell::new(512),
        };

        objmodule::init_module_dict(
            &vm,
            &builtins_dict,
            vm.new_str("builtins".to_owned()),
            vm.get_none(),
        );
        objmodule::init_module_dict(
            &vm,
            &sysmod_dict,
            vm.new_str("sys".to_owned()),
            vm.get_none(),
        );

        builtins::make_module(&vm, builtins.clone());
        sysmodule::make_module(&vm, sysmod, builtins);

        #[cfg(not(target_arch = "wasm32"))]
        import::import_builtin(&vm, "signal").expect("Couldn't initialize signal module");

        vm
    }
/// Create a new `VirtualMachine` structure.
Create a new `VirtualMachine` structure.
Create a new ` VirtualMachine ` structure .
pub fn new(settings: PySettings) -> VirtualMachine {
        flame_guard!("init VirtualMachine");
        let ctx = PyContext::new();
        // make a new module without access to the vm; doesn't
        // set __spec__, __loader__, etc. attributes
        let new_module =
            |dict| PyObject::new(PyModule {}, ctx.types.module_type.clone(), Some(dict));
        // Hard-core modules:
        let builtins_dict = ctx.new_dict();
        let builtins = new_module(builtins_dict.clone());
        let sysmod_dict = ctx.new_dict();
        let sysmod = new_module(sysmod_dict.clone());
        let stdlib_inits = RefCell::new(stdlib::get_module_inits());
        let frozen = RefCell::new(frozen::get_module_inits());
        let import_func = RefCell::new(ctx.none());
        let profile_func = RefCell::new(ctx.none());
        let trace_func = RefCell::new(ctx.none());
        let signal_handlers = RefCell::new(arr![ctx.none(); 64]);
        let vm = VirtualMachine {
            builtins: builtins.clone(),
            sys_module: sysmod.clone(),
            stdlib_inits,
            ctx,
            frames: RefCell::new(vec![]),
            wasm_id: None,
            exceptions: RefCell::new(vec![]),
            frozen,
            import_func,
            profile_func,
            trace_func,
            use_tracing: RefCell::new(false),
            signal_handlers,
            settings,
            recursion_limit: Cell::new(512),
        };
        objmodule::init_module_dict(
            &vm,
            &builtins_dict,
            vm.new_str("builtins".to_owned()),
            vm.get_none(),
        );
        objmodule::init_module_dict(
            &vm,
            &sysmod_dict,
            vm.new_str("sys".to_owned()),
            vm.get_none(),
        );
        builtins::make_module(&vm, builtins.clone());
        sysmodule::make_module(&vm, sysmod, builtins);
        #[cfg(not(target_arch = "wasm32"))]
        import::import_builtin(&vm, "signal").expect("Couldn't initialize signal module");
        vm
    }
pub fn new ( settings : PySettings ) -> VirtualMachine { flame_guard ! ( " " ) ; let ctx = PyContext :: new ( ) ; // make a new module without access to the vm; doesn't // set __spec__, __loader__, etc. attributes let new_module = | dict | PyObject :: new ( PyModule { } , ctx . types . module_type . clone ( ) , Some ( dict ) ) ; // Hard-core modules: let builtins_dict = ctx . new_dict ( ) ; let builtins = new_module ( builtins_dict . clone ( ) ) ; let sysmod_dict = ctx . new_dict ( ) ; let sysmod = new_module ( sysmod_dict . clone ( ) ) ; let stdlib_inits = RefCell :: new ( stdlib :: get_module_inits ( ) ) ; let frozen = RefCell :: new ( frozen :: get_module_inits ( ) ) ; let import_func = RefCell :: new ( ctx . none ( ) ) ; let profile_func = RefCell :: new ( ctx . none ( ) ) ; let trace_func = RefCell :: new ( ctx . none ( ) ) ; let signal_handlers = RefCell :: new ( arr ! [ ctx none ( ) 64 ] ) ; let vm = VirtualMachine { builtins : builtins . clone ( ) , sys_module : sysmod . clone ( ) , stdlib_inits , ctx , frames : RefCell :: new ( vec ! [ ] ) , wasm_id : None , exceptions : RefCell :: new ( vec ! [ ] ) , frozen , import_func , profile_func , trace_func , use_tracing : RefCell :: new ( false ) , signal_handlers , settings , recursion_limit : Cell :: new ( 512 ) , } ; objmodule :: init_module_dict ( & vm , & builtins_dict , vm . new_str ( " " . to_owned ( ) ) , vm . get_none ( ) , ) ; objmodule :: init_module_dict ( & vm , & sysmod_dict , vm . new_str ( " " . to_owned ( ) ) , vm . get_none ( ) , ) ; builtins :: make_module ( & vm , builtins . clone ( ) ) ; sysmodule :: make_module ( & vm , sysmod , builtins ) ; # [ cfg ( not ( target_arch " " ) ) ] import :: import_builtin ( & vm , " " ) . expect ( " " ) ; vm }
Create a new `VirtualMachine` structure.
Create a new ` VirtualMachine ` structure .
settings
PySettings