Patchwork D2172: py3: convert FrameInfo members to bytes

login
register
mail settings
Submitter phabricator
Date Feb. 12, 2018, 3:45 a.m.
Message ID <differential-rev-PHID-DREV-gnhdvminlibunbmzbmrc-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/27643/
State Superseded
Headers show

Comments

phabricator - Feb. 12, 2018, 3:45 a.m.
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The filename and function name fields are system strings. We need
  to convert them to bytes to work with our logging I/O.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/ui.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -1622,12 +1622,12 @@ 
             calframe = inspect.getouterframes(curframe, 2)
             frameinfo = calframe[stacklevel]
 
-            self.write_err('%s at: %s:%s (%s)\n' % (
-                msg, frameinfo.filename, frameinfo.lineno,
-                frameinfo.function))
-            self.log('develwarn', '%s at: %s:%s (%s)\n',
-                     msg, frameinfo.filename, frameinfo.lineno,
-                     frameinfo.function)
+            self.write_err('%s at: %s:%d (%s)\n' % (
+                msg, pycompat.sysbytes(frameinfo.filename),
+                frameinfo.lineno, pycompat.sysbytes(frameinfo.function)))
+            self.log('develwarn', '%s at: %s:%d (%s)\n',
+                     msg, pycompat.sysbytes(frameinfo.filename),
+                     frameinfo.lineno, pycompat.sysbytes(frameinfo.function))
             curframe = calframe = frameinfo = None  # avoid cycles
 
     def deprecwarn(self, msg, version, stacklevel=2):