diff -r 277f4fe6d01a -r 39d13b8c101d mercurial/util.py --- a/mercurial/util.py Thu Oct 20 23:40:24 2016 +0900 +++ b/mercurial/util.py Thu Oct 20 23:53:36 2016 +0900 @@ -986,7 +986,7 @@ if environ is None: environ = {} try: - sys.stdout.flush() + stdout.flush() except Exception: pass def py2shell(val): @@ -2759,9 +2759,9 @@ finally: elapsed = time.time() - start _timenesting[0] -= indent - sys.stderr.write('%s%s: %s\n' % - (' ' * _timenesting[0], func.__name__, - timecount(elapsed))) + stderr.write('%s%s: %s\n' % + (' ' * _timenesting[0], func.__name__, + timecount(elapsed))) return wrapper _sizeunits = (('m', 2**20), ('k', 2**10), ('g', 2**30), @@ -2826,7 +2826,7 @@ else: yield line % (fnmax, fnln, func) -def debugstacktrace(msg='stacktrace', skip=0, f=sys.stderr, otherf=sys.stdout): +def debugstacktrace(msg='stacktrace', skip=0, f=stderr, otherf=stdout): '''Writes a message to f (stderr) with a nicely formatted stacktrace. Skips the 'skip' last entries. By default it will flush stdout first. It can be used everywhere and intentionally does not require an ui object.