Patchwork D2209: ui: convert stack traces to sysbytes before logging

login
register
mail settings
Submitter phabricator
Date Feb. 13, 2018, 3:48 a.m.
Message ID <5dc7ca3cd28c91f2fd4dd747391c57b2@localhost.localdomain>
Download mbox | patch
Permalink /patch/27789/
State Not Applicable
Headers show

Comments

phabricator - Feb. 13, 2018, 3:48 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGdf1760b58fda: ui: convert stack traces to sysbytes before logging (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2209?vs=5601&id=5608

REVISION DETAIL
  https://phab.mercurial-scm.org/D2209

AFFECTED FILES
  mercurial/ui.py

CHANGE DETAILS




To: durin42, #hg-reviewers, indygreg
Cc: mercurial-devel

Patch

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):