File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -250,7 +250,10 @@ impl VirtualMachine {
250250
251251 #[ cfg( any( not( target_arch = "wasm32" ) , target_os = "wasi" ) ) ]
252252 {
253- let io = self . import ( "io" , & [ ] , 0 ) ?;
253+ // this isn't fully compatible with CPython; it imports "io" and sets
254+ // builtins.open to io.OpenWrapper, but this is easier, since it doesn't
255+ // require the Python stdlib to be present
256+ let io = self . import ( "_io" , & [ ] , 0 ) ?;
254257 let io_open = self . get_attribute ( io. clone ( ) , "open" ) ?;
255258 let set_stdio = |name, fd, mode : & str | {
256259 let stdio = self . invoke (
@@ -269,8 +272,7 @@ impl VirtualMachine {
269272 set_stdio ( "stdout" , 1 , "w" ) ?;
270273 set_stdio ( "stderr" , 2 , "w" ) ?;
271274
272- let open_wrapper = self . get_attribute ( io, "OpenWrapper" ) ?;
273- self . set_attr ( & self . builtins , "open" , open_wrapper) ?;
275+ self . set_attr ( & self . builtins , "open" , io_open) ?;
274276 }
275277
276278 Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments