mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-09 22:49:57 +09:00
@@ -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 => {
|
||||
|
||||
Reference in New Issue
Block a user