Patchwork D10131: localrepo: fix conversion of exceptions to strings flagged by pytype

login
register
mail settings
Submitter phabricator
Date March 8, 2021, 11:45 p.m.
Message ID <differential-rev-PHID-DREV-ifomnwg4bqvfuwaffko4-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48446/
State Superseded
Headers show

Comments

phabricator - March 8, 2021, 11:45 p.m.
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is the same as e571fec5b606 <https://phab.mercurial-scm.org/rHGe571fec5b606667d062b7822589879a08324a1a8>.  I assume the 3 similar uses of `bytestr` in
  `__getitem__()` are OK (even though pytype also flags them), because there is
  apparently test coverage for 2 of the 3 cases.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  mercurial/localrepo.py

CHANGE DETAILS




To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -540,7 +540,7 @@ 
         except ValueError as e:
             # Can be raised on Python 3.8 when path is invalid.
             raise error.Abort(
-                _(b'invalid path %s: %s') % (path, pycompat.bytestr(e))
+                _(b'invalid path %s: %s') % (path, stringutil.forcebytestr(e))
             )
 
         raise error.RepoError(_(b'repository %s not found') % path)