@@ -7,7 +7,7 @@ extern crate log;
77use clap:: { App , AppSettings , Arg , ArgMatches } ;
88use rustpython_compiler:: compile;
99use rustpython_vm:: {
10- import , match_class,
10+ match_class,
1111 obj:: { objint:: PyInt , objtuple:: PyTuple , objtype} ,
1212 print_exception,
1313 pyobject:: { ItemProtocol , PyResult } ,
@@ -30,8 +30,9 @@ fn main() {
3030 let app = App :: new ( "RustPython" ) ;
3131 let matches = parse_arguments ( app) ;
3232 let settings = create_settings ( & matches) ;
33- let vm = VirtualMachine :: new ( settings) ;
33+ let mut uninitialized_vm = VirtualMachine :: new ( settings) ;
3434
35+ let vm = uninitialized_vm. initialize ( true ) ;
3536 let res = run_rustpython ( & vm, & matches) ;
3637
3738 #[ cfg( feature = "flame-it" ) ]
@@ -324,9 +325,6 @@ fn write_profile(matches: &ArgMatches) -> Result<(), Box<dyn std::error::Error>>
324325}
325326
326327fn run_rustpython ( vm : & VirtualMachine , matches : & ArgMatches ) -> PyResult < ( ) > {
327- // We only include the standard library bytecode in WASI
328- import:: init_importlib ( & vm, cfg ! ( not( target_os = "wasi" ) ) ) ?;
329-
330328 if let Some ( paths) = option_env ! ( "BUILDTIME_RUSTPYTHONPATH" ) {
331329 let sys_path = vm. get_attribute ( vm. sys_module . clone ( ) , "path" ) ?;
332330 for ( i, path) in std:: env:: split_paths ( paths) . enumerate ( ) {
@@ -446,7 +444,8 @@ fn run_script(vm: &VirtualMachine, scope: Scope, script_file: &str) -> PyResult<
446444
447445#[ test]
448446fn test_run_script ( ) {
449- let vm: VirtualMachine = Default :: default ( ) ;
447+ let mut uninitialized_vm: VirtualMachine = Default :: default ( ) ;
448+ let vm = uninitialized_vm. initialize ( true ) ;
450449
451450 // test file run
452451 let r = run_script (
0 commit comments