py3: use sys.stdout.buffer for binary output in tests/svnxml.py
authorPulkit Goyal <pulkit@yandex-team.ru>
Sat, 13 Oct 2018 03:59:15 +0300
changeset 40216 c17d73bf6a4d
parent 40215 4d6019c0e0ef
child 40217 6e7789064c21
py3: use sys.stdout.buffer for binary output in tests/svnxml.py Just following 6c0b1d964537ab62d76c208f5f04ab414814c94e here. Differential Revision: https://phab.mercurial-scm.org/D5027
tests/svnxml.py
--- a/tests/svnxml.py	Sat Oct 13 03:58:20 2018 +0300
+++ b/tests/svnxml.py	Sat Oct 13 03:59:15 2018 +0300
@@ -35,7 +35,10 @@
     return entries
 
 def printentries(entries):
-    fp = sys.stdout
+    try:
+        fp = sys.stdout.buffer
+    except AttributeError:
+        fp = sys.stdout
     for e in entries:
         for k in ('revision', 'author', 'msg'):
             fp.write(('%s: %s\n' % (k, e[k])).encode('utf-8'))