comparison mercurial/ui.py @ 36165:df1760b58fda

ui: convert stack traces to sysbytes before logging They're coming back as unicodes, so sysbytes seems like the best we can do. This is like D2171 and D2172, but those fail on Python 2.7.5 (seriously!), so this is my version of the same change. I actually wrote this before reviewing those, then discarded it, then came back to it after finding out 2.7.5 is a silly place. Differential Revision: https://phab.mercurial-scm.org/D2209
author Augie Fackler <augie@google.com>
date Mon, 12 Feb 2018 20:42:28 -0500
parents 8f5c7f906f9b
children ddeb7653b31c
comparison
equal deleted inserted replaced
36164:8f5c7f906f9b 36165:df1760b58fda
1618 self.log('develwarn', '%s at:\n%s' % 1618 self.log('develwarn', '%s at:\n%s' %
1619 (msg, ''.join(util.getstackframes(stacklevel)))) 1619 (msg, ''.join(util.getstackframes(stacklevel))))
1620 else: 1620 else:
1621 curframe = inspect.currentframe() 1621 curframe = inspect.currentframe()
1622 calframe = inspect.getouterframes(curframe, 2) 1622 calframe = inspect.getouterframes(curframe, 2)
1623 self.write_err('%s at: %s:%s (%s)\n' 1623 fname, lineno, fmsg = calframe[stacklevel][1:4]
1624 % ((msg,) + calframe[stacklevel][1:4])) 1624 fname, fmsg = pycompat.sysbytes(fname), pycompat.sysbytes(fmsg)
1625 self.log('develwarn', '%s at: %s:%s (%s)\n', 1625 self.write_err('%s at: %s:%d (%s)\n'
1626 msg, *calframe[stacklevel][1:4]) 1626 % (msg, fname, lineno, fmsg))
1627 self.log('develwarn', '%s at: %s:%d (%s)\n',
1628 msg, fname, lineno, fmsg)
1627 curframe = calframe = None # avoid cycles 1629 curframe = calframe = None # avoid cycles
1628 1630
1629 def deprecwarn(self, msg, version, stacklevel=2): 1631 def deprecwarn(self, msg, version, stacklevel=2):
1630 """issue a deprecation warning 1632 """issue a deprecation warning
1631 1633