[diffoscope] 04/08: comparators: utils: command: removes decode from stdout

Juliana Oliveira jwnx-guest at moszumanska.debian.org
Wed Jan 31 16:51:31 CET 2018


This is an automated email from the git hooks/post-receive script.

jwnx-guest pushed a commit to branch jwnx_subprocess_merge
in repository diffoscope.

commit 79ea91f7c4b13796a709ca222b8c788b8b6957fb
Author: Juliana Oliveira <juliana.orod at gmail.com>
Date:   Tue Jan 23 01:50:24 2018 -0200

    comparators: utils: command: removes decode from stdout
    
    Decoding shouldn't be done inside Command, but inside Feeders. Having
    decode on stdout breaks gettext encoding. This patch removes decode from
    Command and adds it to Feeders.
    
    Signed-off-by: Juliana Oliveira <juliana.orod at gmail.com>
---
 diffoscope/comparators/utils/command.py | 2 +-
 diffoscope/feeders.py                   | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/diffoscope/comparators/utils/command.py b/diffoscope/comparators/utils/command.py
index 9abc158..f2c8b5a 100644
--- a/diffoscope/comparators/utils/command.py
+++ b/diffoscope/comparators/utils/command.py
@@ -102,4 +102,4 @@ class Command(object, metaclass=abc.ABCMeta):
 
     @property
     def stdout(self):
-        return self._process.stdout.decode().splitlines(True)
+        return self._process.stdout.splitlines(True)
diff --git a/diffoscope/feeders.py b/diffoscope/feeders.py
index 04a3440..8522584 100644
--- a/diffoscope/feeders.py
+++ b/diffoscope/feeders.py
@@ -43,7 +43,6 @@ def from_raw_reader(in_file, filter=None):
             h = hashlib.sha1()
 
         for buf in in_file:
-            buf = buf.encode('utf-8')
             line_count += 1
             out = buf if filter is None else filter(buf)
 
@@ -72,7 +71,7 @@ def from_raw_reader(in_file, filter=None):
 def from_text_reader(in_file, filter=None):
     if filter is None:
         def encoding_filter(text_buf):
-            return text_buf
+            return text_buf.encode('utf-8')
     else:
         def encoding_filter(text_buf):
             return filter(text_buf).encode('utf-8')

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git


More information about the diffoscope mailing list