@@ -15,28 +15,28 @@ use crate::obj::objstr;
1515use crate :: pyobject:: { PyContext , PyFuncArgs , PyObjectRef , PyResult , TypeProtocol } ;
1616use crate :: vm:: VirtualMachine ;
1717
18- #[ cfg( target_family = " unix" ) ]
18+ #[ cfg( unix) ]
1919pub fn raw_file_number ( handle : File ) -> i64 {
2020 use std:: os:: unix:: io:: IntoRawFd ;
2121
2222 i64:: from ( handle. into_raw_fd ( ) )
2323}
2424
25- #[ cfg( target_family = " unix" ) ]
25+ #[ cfg( unix) ]
2626pub fn rust_file ( raw_fileno : i64 ) -> File {
2727 use std:: os:: unix:: io:: FromRawFd ;
2828
2929 unsafe { File :: from_raw_fd ( raw_fileno as i32 ) }
3030}
3131
32- #[ cfg( target_family = " windows" ) ]
32+ #[ cfg( windows) ]
3333pub fn raw_file_number ( handle : File ) -> i64 {
3434 use std:: os:: windows:: io:: IntoRawHandle ;
3535
3636 handle. into_raw_handle ( ) as i64
3737}
3838
39- #[ cfg( target_family = " windows" ) ]
39+ #[ cfg( windows) ]
4040pub fn rust_file ( raw_fileno : i64 ) -> File {
4141 use std:: ffi:: c_void;
4242 use std:: os:: windows:: io:: FromRawHandle ;
@@ -45,6 +45,16 @@ pub fn rust_file(raw_fileno: i64) -> File {
4545 unsafe { File :: from_raw_handle ( raw_fileno as * mut c_void ) }
4646}
4747
48+ #[ cfg( all( not( unix) , not( windows) ) ) ]
49+ pub fn rust_file ( raw_fileno : i64 ) -> File {
50+ unimplemented ! ( ) ;
51+ }
52+
53+ #[ cfg( all( not( unix) , not( windows) ) ) ]
54+ pub fn raw_file_number ( handle : File ) -> i64 {
55+ unimplemented ! ( ) ;
56+ }
57+
4858pub fn os_close ( vm : & mut VirtualMachine , args : PyFuncArgs ) -> PyResult {
4959 arg_check ! ( vm, args, required = [ ( fileno, Some ( vm. ctx. int_type( ) ) ) ] ) ;
5060
0 commit comments