D2209: ui: convert stack traces to sysbytes before logging
durin42 (Augie Fackler)
phabricator at mercurial-scm.org
Tue Feb 13 03:30:22 UTC 2018
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
They're coming back as unicodes, so sysbytes seems like the best we can do.
This is like https://phab.mercurial-scm.org/D2171 and https://phab.mercurial-scm.org/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.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D2209
AFFECTED FILES
mercurial/ui.py
CHANGE DETAILS
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -1620,10 +1620,12 @@
else:
curframe = inspect.currentframe()
calframe = inspect.getouterframes(curframe, 2)
- self.write_err('%s at: %s:%s (%s)\n'
- % ((msg,) + calframe[stacklevel][1:4]))
- self.log('develwarn', '%s at: %s:%s (%s)\n',
- msg, *calframe[stacklevel][1:4])
+ fname, lineno, fmsg = calframe[stacklevel][1:4]
+ fname, fmsg = pycompat.sysbytes(fname), pycompat.sysbytes(fmsg)
+ self.write_err('%s at: %s:%d (%s)\n'
+ % (msg, fname, lineno, fmsg))
+ self.log('develwarn', '%s at: %s:%d (%s)\n',
+ msg, fname, lineno, fmsg)
curframe = calframe = None # avoid cycles
def deprecwarn(self, msg, version, stacklevel=2):
To: durin42, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list