Mercurial > hg
diff mercurial/cmdutil.py @ 35903:1a31111e6239
py3: always drop b'' prefix from repr() of bytestr
Perhaps this is what we wanted for py2-3 compatibility.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 27 Jan 2018 17:31:25 +0900 |
parents | 72de5c504833 |
children | fc44c2657dc5 |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Sat Jan 27 17:13:51 2018 +0900 +++ b/mercurial/cmdutil.py Sat Jan 27 17:31:25 2018 +0900 @@ -1563,17 +1563,9 @@ if fo is not None: fo.close() -class _regrettablereprbytes(bytes): - """Bytes subclass that makes the repr the same on Python 3 as Python 2. - - This is a huge hack. - """ - def __repr__(self): - return repr(pycompat.sysstr(self)) - def _maybebytestr(v): - if pycompat.ispy3 and isinstance(v, bytes): - return _regrettablereprbytes(v) + if isinstance(v, bytes): + return pycompat.bytestr(v) return v def showmarker(fm, marker, index=None):