D10170: branchmap: force Exception to bytes before logging

mharbison72 (Matt Harbison) phabricator at mercurial-scm.org
Fri Mar 12 18:08:43 UTC 2021


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

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



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


More information about the Mercurial-devel mailing list