# HG changeset patch # User Yuya Nishihara # Date 1525953658 -32400 # Node ID af83a0ed0afbb3fbfdd3fdcd972ebaefabe16bb7 # Parent 31c37e703cee68ae697ea0ede411b2d593491555 stringutil: make pprint() forward uninteresting object to b'%r' We appear to start using pprint() as a replacement for repr(), so it's probably safer to support any Python objects instead of complaining about that. diff -r 31c37e703cee -r af83a0ed0afb mercurial/utils/stringutil.py --- a/mercurial/utils/stringutil.py Fri Apr 27 13:46:54 2018 -0400 +++ b/mercurial/utils/stringutil.py Thu May 10 21:00:58 2018 +0900 @@ -40,18 +40,10 @@ '%s: %s' % (pprint(k, bprefix=bprefix), pprint(v, bprefix=bprefix)) for k, v in sorted(o.items()))) - elif isinstance(o, bool): - return b'True' if o else b'False' - elif isinstance(o, int): - return '%d' % o - elif isinstance(o, float): - return '%f' % o elif isinstance(o, tuple): return '(%s)' % (b', '.join(pprint(a, bprefix=bprefix) for a in o)) - elif o is None: - return b'None' else: - raise error.ProgrammingError('do not know how to format %r' % o) + return pycompat.byterepr(o) def binary(s): """return true if a string is binary data"""