Mercurial > public > mercurial-scm > hg-stable
diff mercurial/pycompat.py @ 31263:64596338ba10
py3: factor out bytechr() function
I also changed xrange(127) to range(127) as the number is relatively small.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Wed, 08 Mar 2017 22:30:12 +0900 |
parents | 76a64c1e5439 |
children | 295625f1296b |
line wrap: on
line diff
--- a/mercurial/pycompat.py Thu Mar 02 13:34:01 2017 +0100 +++ b/mercurial/pycompat.py Wed Mar 08 22:30:12 2017 +0900 @@ -71,6 +71,9 @@ # workaround to simulate the Python 2 (i.e. ANSI Win32 API) behavior. sysargv = list(map(os.fsencode, sys.argv)) + def bytechr(i): + return bytes([i]) + def sysstr(s): """Return a keyword str to be passed to Python functions such as getattr() and str.encode() @@ -134,6 +137,8 @@ return [a.encode('latin-1') for a in ret] else: + bytechr = chr + def sysstr(s): return s