@@ -15,28 +15,28 @@ use crate::obj::objstr;
15
15
use crate :: pyobject:: { PyContext , PyFuncArgs , PyObjectRef , PyResult , TypeProtocol } ;
16
16
use crate :: vm:: VirtualMachine ;
17
17
18
- #[ cfg( target_family = " unix" ) ]
18
+ #[ cfg( unix) ]
19
19
pub fn raw_file_number ( handle : File ) -> i64 {
20
20
use std:: os:: unix:: io:: IntoRawFd ;
21
21
22
22
i64:: from ( handle. into_raw_fd ( ) )
23
23
}
24
24
25
- #[ cfg( target_family = " unix" ) ]
25
+ #[ cfg( unix) ]
26
26
pub fn rust_file ( raw_fileno : i64 ) -> File {
27
27
use std:: os:: unix:: io:: FromRawFd ;
28
28
29
29
unsafe { File :: from_raw_fd ( raw_fileno as i32 ) }
30
30
}
31
31
32
- #[ cfg( target_family = " windows" ) ]
32
+ #[ cfg( windows) ]
33
33
pub fn raw_file_number ( handle : File ) -> i64 {
34
34
use std:: os:: windows:: io:: IntoRawHandle ;
35
35
36
36
handle. into_raw_handle ( ) as i64
37
37
}
38
38
39
- #[ cfg( target_family = " windows" ) ]
39
+ #[ cfg( windows) ]
40
40
pub fn rust_file ( raw_fileno : i64 ) -> File {
41
41
use std:: ffi:: c_void;
42
42
use std:: os:: windows:: io:: FromRawHandle ;
@@ -45,6 +45,16 @@ pub fn rust_file(raw_fileno: i64) -> File {
45
45
unsafe { File :: from_raw_handle ( raw_fileno as * mut c_void ) }
46
46
}
47
47
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
+
48
58
pub fn os_close ( vm : & mut VirtualMachine , args : PyFuncArgs ) -> PyResult {
49
59
arg_check ! ( vm, args, required = [ ( fileno, Some ( vm. ctx. int_type( ) ) ) ] ) ;
50
60
0 commit comments