Show More
@@ -31,12 +31,12 b' use std::convert::TryFrom;' | |||||
31 | use std::ffi::CStr; |
|
31 | use std::ffi::CStr; | |
32 | use std::mem::transmute; |
|
32 | use std::mem::transmute; | |
33 |
|
33 | |||
34 |
// |
|
34 | // C code uses a custom `dirstate_tuple` type, checks in multiple instances | |
35 |
// |
|
35 | // for this type, and raises a Python `Exception` if the check does not pass. | |
36 |
// |
|
36 | // Because this type differs only in name from the regular Python tuple, it | |
37 |
// |
|
37 | // would be a good idea in the near future to remove it entirely to allow | |
38 |
// |
|
38 | // for a pure Python tuple of the same effective structure to be used, | |
39 |
// |
|
39 | // rendering this type and the capsule below useless. | |
40 | type MakeDirstateTupleFn = unsafe extern "C" fn( |
|
40 | type MakeDirstateTupleFn = unsafe extern "C" fn( | |
41 | state: c_char, |
|
41 | state: c_char, | |
42 | mode: c_int, |
|
42 | mode: c_int, | |
@@ -44,9 +44,9 b' type MakeDirstateTupleFn = unsafe extern' | |||||
44 | mtime: c_int, |
|
44 | mtime: c_int, | |
45 | ) -> *mut python_sys::PyObject; |
|
45 | ) -> *mut python_sys::PyObject; | |
46 |
|
46 | |||
47 |
// |
|
47 | // This is largely a copy/paste from cindex.rs, pending the merge of a | |
48 |
// |
|
48 | // `py_capsule_fn!` macro in the rust-cpython project: | |
49 |
// |
|
49 | // https://github.com/dgrunwald/rust-cpython/pull/169 | |
50 | fn decapsule_make_dirstate_tuple(py: Python) -> PyResult<MakeDirstateTupleFn> { |
|
50 | fn decapsule_make_dirstate_tuple(py: Python) -> PyResult<MakeDirstateTupleFn> { | |
51 | unsafe { |
|
51 | unsafe { | |
52 | let caps_name = CStr::from_bytes_with_nul_unchecked( |
|
52 | let caps_name = CStr::from_bytes_with_nul_unchecked( |
General Comments 0
You need to be logged in to leave comments.
Login now