##// END OF EJS Templates
rust-cpython: mark capsule function as unsafe
Yuya Nishihara -
r43480:8b355cbe default
parent child Browse files
Show More
@@ -36,7 +36,7 b' use std::mem::transmute;'
36 /// would be a good idea in the near future to remove it entirely to allow
36 /// would be a good idea in the near future to remove it entirely to allow
37 /// for a pure Python tuple of the same effective structure to be used,
37 /// for a pure Python tuple of the same effective structure to be used,
38 /// rendering this type and the capsule below useless.
38 /// rendering this type and the capsule below useless.
39 type MakeDirstateTupleFn = extern "C" fn(
39 type MakeDirstateTupleFn = unsafe extern "C" fn(
40 state: c_char,
40 state: c_char,
41 mode: c_int,
41 mode: c_int,
42 size: c_int,
42 size: c_int,
@@ -75,7 +75,11 b' pub fn make_dirstate_tuple('
75 // because Into<u8> has a specific implementation while `as c_char` would
75 // because Into<u8> has a specific implementation while `as c_char` would
76 // just do a naive enum cast.
76 // just do a naive enum cast.
77 let state_code: u8 = state.into();
77 let state_code: u8 = state.into();
78 Ok(make(state_code as c_char, mode, size, mtime))
78
79 unsafe {
80 let ptr = make(state_code as c_char, mode, size, mtime);
81 Ok(ptr)
82 }
79 }
83 }
80
84
81 pub fn extract_dirstate(py: Python, dmap: &PyDict) -> Result<StateMap, PyErr> {
85 pub fn extract_dirstate(py: Python, dmap: &PyDict) -> Result<StateMap, PyErr> {
General Comments 0
You need to be logged in to leave comments. Login now