Patchwork D2663: py3: use util.forcebytestr to convert testedwith value to bytes

login
register
mail settings
Submitter phabricator
Date March 4, 2018, 7:40 p.m.
Message ID <differential-rev-PHID-DREV-t2ntl5ngttrommaohkc2-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/28974/
State Superseded
Headers show

Comments

phabricator - March 4, 2018, 7:40 p.m.
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Bad extensions can put anything in testedwith so we should use util.forcebytestr
  here.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/dispatch.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -990,7 +990,7 @@ 
     if worst[0] is not None:
         name, testedwith, report = worst
         if not isinstance(testedwith, (bytes, str)):
-            testedwith = '.'.join([str(c) for c in testedwith])
+            testedwith = '.'.join([util.forcebytestr(c) for c in testedwith])
         warning = (_('** Unknown exception encountered with '
                      'possibly-broken third-party extension %s\n'
                      '** which supports versions %s of Mercurial.\n'