D10173: grep: convert an exception to bytes for a warning message
mharbison72 (Matt Harbison)
phabricator at mercurial-scm.org
Fri Mar 12 18:09:50 UTC 2021
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
Caught by pytype:
File "/mnt/c/Users/Matt/hg/mercurial/commands.py", line 3457, in grep: Function _bytestr.__init__ was called with the wrong arguments [wrong-arg-types]
Expected: (self, ints: Iterable[int])
Actually passed: (self, ints: re.error)
The following methods aren't implemented on re.error:
__iter__
REPOSITORY
rHG Mercurial
BRANCH
stable
REVISION DETAIL
https://phab.mercurial-scm.org/D10173
AFFECTED FILES
mercurial/commands.py
CHANGE DETAILS
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3444,7 +3444,8 @@
regexp = util.re.compile(pattern, reflags)
except re.error as inst:
ui.warn(
- _(b"grep: invalid match pattern: %s\n") % pycompat.bytestr(inst)
+ _(b"grep: invalid match pattern: %s\n")
+ % stringutil.forcebytestr(inst)
)
return 1
sep, eol = b':', b'\n'
To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
More information about the Mercurial-devel
mailing list