##// END OF EJS Templates
rust-cpython: do not convert warning pattern to utf-8 bytes...
Yuya Nishihara -
r44161:3078f9a4 default draft
parent child Browse files
Show More
@@ -29,6 +29,14 b' pub fn get_path_from_bytes(bytes: &[u8])'
29 Path::new(os_str)
29 Path::new(os_str)
30 }
30 }
31
31
32 // TODO: need to convert from WTF8 to MBCS bytes on Windows.
33 // that's why Vec<u8> is returned.
34 #[cfg(unix)]
35 pub fn get_bytes_from_path(path: impl AsRef<Path>) -> Vec<u8> {
36 use std::os::unix::ffi::OsStrExt;
37 path.as_ref().as_os_str().as_bytes().to_vec()
38 }
39
32 /// An iterator over repository path yielding itself and its ancestors.
40 /// An iterator over repository path yielding itself and its ancestors.
33 #[derive(Copy, Clone, Debug)]
41 #[derive(Copy, Clone, Debug)]
34 pub struct Ancestors<'a> {
42 pub struct Ancestors<'a> {
@@ -68,7 +68,7 b' fn warnings_to_py_bytes('
68 .iter()
68 .iter()
69 .map(|(path, syn)| {
69 .map(|(path, syn)| {
70 (
70 (
71 PyBytes::new(py, &path.to_string_lossy().as_bytes()),
71 PyBytes::new(py, &files::get_bytes_from_path(path)),
72 PyBytes::new(py, syn),
72 PyBytes::new(py, syn),
73 )
73 )
74 })
74 })
General Comments 0
You need to be logged in to leave comments. Login now