diff mercurial/pycompat.py @ 36298:b44fac3a49fb

py3: factor out byterepr() which returns an asciified value on py3
author Yuya Nishihara <yuya@tcha.org>
date Sat, 17 Feb 2018 18:09:56 +0900
parents 646002338365
children 4cd2d1cc2a31
line wrap: on
line diff
--- a/mercurial/pycompat.py	Thu Feb 15 17:14:45 2018 +0530
+++ b/mercurial/pycompat.py	Sat Feb 17 18:09:56 2018 +0900
@@ -85,6 +85,7 @@
         sysargv = list(map(os.fsencode, sys.argv))
 
     bytechr = struct.Struct('>B').pack
+    byterepr = b'%r'.__mod__
 
     class bytestr(bytes):
         """A bytes which mostly acts as a Python 2 str
@@ -277,6 +278,7 @@
     import cStringIO
 
     bytechr = chr
+    byterepr = repr
     bytestr = str
     iterbytestr = iter
     maybebytestr = identity