[Reproducible-commits] [diffoscope] 10/23: XXX PYTHON3 XXX encode sys.stdout buffer not the stream

Jérémy Bobbio lunar at moszumanska.debian.org
Sat Sep 19 23:18:21 UTC 2015


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

lunar pushed a commit to branch pu/py3
in repository diffoscope.

commit af16ff96aece800aa4fa6b14dd044505d66f0de9
Author: Jérémy Bobbio <lunar at debian.org>
Date:   Sat Sep 19 18:46:19 2015 +0200

    XXX PYTHON3 XXX encode sys.stdout buffer not the stream
---
 diffoscope/__main__.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/diffoscope/__main__.py b/diffoscope/__main__.py
index 6971c2f..84d0f8f 100644
--- a/diffoscope/__main__.py
+++ b/diffoscope/__main__.py
@@ -82,8 +82,8 @@ def create_parser():
 def make_printer(path):
     if path == '-':
         output = sys.stdout
-        if not sys.stdout.isatty():
-            output = codecs.getwriter(sys.stdin.encoding or 'utf-8')(sys.stdout)
+        if not sys.stdout.isatty() and hasattr(sys.stdout, 'buffer'):
+            output = codecs.getwriter(sys.stdin.encoding or 'utf-8')(sys.stdout.buffer)
     else:
         output = codecs.open(path, 'w', encoding='utf-8')
     def print_func(*args, **kwargs):

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



More information about the Reproducible-commits mailing list