Patchwork D7612: py3: send bytes from Rust-created warning patterns

login
register
mail settings
Submitter phabricator
Date Dec. 13, 2019, 6:17 p.m.
Message ID <e4bbc45da3a587cc0d5d0122cf6234f8@localhost.localdomain>
Download mbox | patch
Permalink /patch/43799/
State Not Applicable
Headers show

Comments

phabricator - Dec. 13, 2019, 6:17 p.m.
Closed by commit rHGa264e8a91798: py3: send bytes from Rust-created warning patterns (authored by Alphare).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7612?vs=18642&id=18690

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7612/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7612

AFFECTED FILES
  rust/hg-cpython/src/filepatterns.rs

CHANGE DETAILS




To: Alphare, #hg-reviewers
Cc: durin42, kevincox, mercurial-devel

Patch

diff --git a/rust/hg-cpython/src/filepatterns.rs b/rust/hg-cpython/src/filepatterns.rs
--- a/rust/hg-cpython/src/filepatterns.rs
+++ b/rust/hg-cpython/src/filepatterns.rs
@@ -13,8 +13,7 @@ 
 //!
 use crate::exceptions::{PatternError, PatternFileError};
 use cpython::{
-    PyBytes, PyDict, PyModule, PyObject, PyResult, PyString, PyTuple, Python,
-    ToPyObject,
+    PyBytes, PyDict, PyModule, PyObject, PyResult, PyTuple, Python, ToPyObject,
 };
 use hg::{
     build_single_regex, read_pattern_file, utils::files::get_path_from_bytes,
@@ -66,12 +65,12 @@ 
 fn warnings_to_py_bytes(
     py: Python,
     warnings: &[(PathBuf, Vec<u8>)],
-) -> Vec<(PyString, PyBytes)> {
+) -> Vec<(PyBytes, PyBytes)> {
     warnings
         .iter()
         .map(|(path, syn)| {
             (
-                PyString::new(py, &path.to_string_lossy()),
+                PyBytes::new(py, &path.to_string_lossy().as_bytes()),
                 PyBytes::new(py, syn),
             )
         })