diff --git a/vm/src/stdlib/os.rs b/vm/src/stdlib/os.rs index f0550d587..b4d52fe09 100644 --- a/vm/src/stdlib/os.rs +++ b/vm/src/stdlib/os.rs @@ -6,6 +6,8 @@ use std::fs::OpenOptions; use std::io::{self, Error, ErrorKind, Read, Write}; #[cfg(unix)] use std::os::unix::fs::OpenOptionsExt; +#[cfg(windows)] +use std::os::windows::fs::OpenOptionsExt; use std::time::{Duration, SystemTime}; use std::{env, fs}; @@ -91,6 +93,7 @@ pub fn os_close(vm: &VirtualMachine, args: PyFuncArgs) -> PyResult { Ok(vm.get_none()) } +#[cfg(any(unix, windows))] pub fn os_open(vm: &VirtualMachine, args: PyFuncArgs) -> PyResult { arg_check!( vm, @@ -126,6 +129,11 @@ pub fn os_open(vm: &VirtualMachine, args: PyFuncArgs) -> PyResult { Ok(vm.ctx.new_int(raw_file_number(handle))) } +#[cfg(all(not(unix), not(windows)))] +pub fn os_open(vm: &VirtualMachine, args: PyFuncArgs) -> PyResult { + unimplemented!() +} + pub fn convert_io_error(vm: &VirtualMachine, err: io::Error) -> PyObjectRef { let os_error = match err.kind() { ErrorKind::NotFound => {