Patchwork D10170: branchmap: force Exception to bytes before logging

login
register
mail settings
Submitter phabricator
Date March 12, 2021, 6:08 p.m.
Message ID <differential-rev-PHID-DREV-bign7icnpipbapz5fgj3-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48485/
State Superseded
Headers show

Comments

phabricator - March 12, 2021, 6:08 p.m.
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Here was an instance where `black` mangled the formatting so that `pytype`
  didn't recognize the suppression directive.  But it seems that the error was
  correct, and the code should follow other recent changes around exception
  conversion.
  
    File "/mnt/c/Users/Matt/hg/mercurial/branchmap.py", line 303, in fromfile: Function _bytestr.__init__ was called with the wrong arguments [wrong-arg-types]
             Expected: (self, ints: Iterable[int])
      Actually passed: (self, ints: Exception)
      The following methods aren't implemented on Exception:
      __iter__

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  mercurial/branchmap.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -299,9 +299,7 @@ 
                     msg
                     % (
                         _branchcachedesc(repo),
-                        pycompat.bytestr(
-                            inst
-                        ),  # pytype: disable=wrong-arg-types
+                        stringutil.forcebytestr(inst),
                     )
                 )
             bcache = None