Mercurial > public > mercurial-scm > hg
comparison mercurial/verify.py @ 46696:ed0899e01628 stable
verify: convert an exception to bytes before logging
I'm not entirely sure why this code appears to be trying to convert twice, but
it was flagged by pytype:
File "/mnt/c/Users/Matt/hg/mercurial/verify.py", line 84, in _exc: 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__
Differential Revision: https://phab.mercurial-scm.org/D10181
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Thu, 11 Mar 2021 21:02:03 -0500 |
parents | e77b57e09bfa |
children | 5137896602d9 |
comparison
equal
deleted
inserted
replaced
46695:8da44c36fc74 | 46696:ed0899e01628 |
---|---|
11 | 11 |
12 from .i18n import _ | 12 from .i18n import _ |
13 from .node import ( | 13 from .node import ( |
14 nullid, | 14 nullid, |
15 short, | 15 short, |
16 ) | |
17 from .utils import ( | |
18 stringutil, | |
16 ) | 19 ) |
17 | 20 |
18 from . import ( | 21 from . import ( |
19 error, | 22 error, |
20 pycompat, | 23 pycompat, |
79 self.ui.warn(b" " + msg + b"\n") | 82 self.ui.warn(b" " + msg + b"\n") |
80 self.errors += 1 | 83 self.errors += 1 |
81 | 84 |
82 def _exc(self, linkrev, msg, inst, filename=None): | 85 def _exc(self, linkrev, msg, inst, filename=None): |
83 """record exception raised during the verify process""" | 86 """record exception raised during the verify process""" |
84 fmsg = pycompat.bytestr(inst) | 87 fmsg = stringutil.forcebytestr(inst) |
85 if not fmsg: | 88 if not fmsg: |
86 fmsg = pycompat.byterepr(inst) | 89 fmsg = pycompat.byterepr(inst) |
87 self._err(linkrev, b"%s: %s" % (msg, fmsg), filename) | 90 self._err(linkrev, b"%s: %s" % (msg, fmsg), filename) |
88 | 91 |
89 def _checkrevlog(self, obj, name, linkrev): | 92 def _checkrevlog(self, obj, name, linkrev): |