--- a/mercurial/util.py Wed Aug 01 16:03:32 2018 -0700
+++ b/mercurial/util.py Thu Aug 02 20:53:03 2018 +0100
@@ -2890,9 +2890,11 @@
# the number of nested timedcm context managers.
level = attr.ib(default=1)
- def __str__(self):
+ def __bytes__(self):
return timecount(self.elapsed) if self.elapsed else '<unknown>'
+ __str__ = encoding.strmethod(__bytes__)
+
@contextlib.contextmanager
def timedcm():
"""A context manager that produces timing information for a given context.
@@ -2929,7 +2931,8 @@
result = func(*args, **kwargs)
stderr = procutil.stderr
stderr.write('%s%s: %s\n' % (
- ' ' * time_stats.level * 2, func.__name__, time_stats))
+ ' ' * time_stats.level * 2, pycompat.bytestr(func.__name__),
+ time_stats))
return result
return wrapper