@@ -16,35 +16,35 @@ use super::super::pyobject::{PyContext, PyFuncArgs, PyObjectRef, PyResult, TypeP
16
16
use super :: super :: vm:: VirtualMachine ;
17
17
18
18
#[ cfg( target_family = "unix" ) ]
19
- pub fn raw_file_number ( handle : File ) -> i32 {
19
+ pub fn raw_file_number ( handle : File ) -> i64 {
20
20
use std:: os:: unix:: io:: IntoRawFd ;
21
21
22
- handle. into_raw_fd ( )
22
+ handle. into_raw_fd ( ) as i64
23
23
}
24
24
25
25
#[ cfg( target_family = "unix" ) ]
26
- pub fn rust_file ( raw_fileno : i32 ) -> File {
26
+ pub fn rust_file ( raw_fileno : i64 ) -> File {
27
27
use std:: os:: unix:: io:: FromRawFd ;
28
28
29
- unsafe { File :: from_raw_fd ( raw_fileno) }
29
+ unsafe { File :: from_raw_fd ( raw_fileno as i32 ) }
30
30
}
31
31
32
32
#[ cfg( target_family = "windows" ) ]
33
- pub fn raw_file_number ( handle : File ) -> i32 {
33
+ pub fn raw_file_number ( handle : File ) -> i64 {
34
34
use std:: os:: windows:: io:: IntoRawHandle ;
35
35
36
- handle. into_raw_handle ( ) as i32
36
+ handle. into_raw_handle ( ) as i64
37
37
}
38
38
39
39
#[ cfg( target_family = "windows" ) ]
40
- pub fn rust_file ( raw_fileno : i32 ) -> File {
40
+ pub fn rust_file ( raw_fileno : i64 ) -> File {
41
41
use std:: ffi:: c_void;
42
42
use std:: os:: windows:: io:: FromRawHandle ;
43
43
44
44
//TODO: This is untested and (very) unsafe handling or
45
- //raw pointers - This should be patched as a matter of
46
- //urgently patched by comparison to the cpython handling of
47
- //the equivalent fileno fields for windows
45
+ //raw pointers - This should be patched urgently by
46
+ //comparison to the cpython handling of the equivalent fileno
47
+ //fields for windows
48
48
unsafe { File :: from_raw_handle ( raw_fileno as * mut c_void ) }
49
49
}
50
50
@@ -56,7 +56,7 @@ pub fn os_close(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
56
56
//The File type automatically closes when it goes out of scope.
57
57
//To enable us to close these file desciptors (and hence prevent leaks)
58
58
//we seek to create the relevant File and simply let it pass out of scope!
59
- rust_file ( raw_fileno. to_i32 ( ) . unwrap ( ) ) ;
59
+ rust_file ( raw_fileno. to_i64 ( ) . unwrap ( ) ) ;
60
60
61
61
Ok ( vm. get_none ( ) )
62
62
}
0 commit comments