File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change 33 */
44use crate :: pyobject:: PyObjectRef ;
55use crate :: VirtualMachine ;
6+ pub ( crate ) use _io:: io_open as open;
67
78pub ( crate ) fn make_module ( vm : & VirtualMachine ) -> PyObjectRef {
89 let module = _io:: make_module ( vm) ;
Original file line number Diff line number Diff line change @@ -320,9 +320,13 @@ impl VirtualMachine {
320320 // builtins.open to io.OpenWrapper, but this is easier, since it doesn't
321321 // require the Python stdlib to be present
322322 let io = import:: import_builtin ( self , "_io" ) ?;
323- let io_open = self . get_attribute ( io, "open" ) ?;
324323 let set_stdio = |name, fd, mode : & str | {
325- let stdio = self . invoke ( & io_open, ( fd, mode) ) ?;
324+ let stdio = crate :: stdlib:: io:: open (
325+ self . ctx . new_int ( fd) ,
326+ Some ( mode) ,
327+ Default :: default ( ) ,
328+ self ,
329+ ) ?;
326330 self . set_attr (
327331 & self . sys_module ,
328332 format ! ( "__{}__" , name) , // e.g. __stdin__
@@ -335,6 +339,7 @@ impl VirtualMachine {
335339 set_stdio ( "stdout" , 1 , "w" ) ?;
336340 set_stdio ( "stderr" , 2 , "w" ) ?;
337341
342+ let io_open = self . get_attribute ( io, "open" ) ?;
338343 self . set_attr ( & self . builtins , "open" , io_open) ?;
339344 }
340345
You can’t perform that action at this time.
0 commit comments