We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parentaa48718 commitaa9e4bdCopy full SHA for aa9e4bd
vm/src/stdlib/io.rs
@@ -7,6 +7,7 @@ use std::collections::HashSet;
7
use std::fs::File;
8
use std::io::prelude::*;
9
use std::io::BufReader;
10
+use std::path::PathBuf;
11
12
//3rd party imports
13
use num_bigint::ToBigInt;
@@ -24,6 +25,7 @@ use crate::pyobject::{
24
25
};
26
27
usecrate::vm::VirtualMachine;
28
+usecrate::import;
29
30
fncompute_c_flag(mode:&str) ->u16{
31
match mode{
@@ -267,7 +269,7 @@ pub fn io_open(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
267
269
optional =[(mode,Some(vm.ctx.str_type()))]
268
270
);
271
-let module =mk_module(&vm.ctx);
272
+let module =import::import_module(vm,PathBuf::default(),"io").unwrap();
273
274
//mode is optional: 'rt' is the default mode (open from reading text)
275
let rust_mode = mode.map_or("rt".to_string(), |m| objstr::get_value(m));