[Updated] D11471: parser: force a `ValueError` to bytes before passing to `error.ParseError`
mharbison72 (Matt Harbison)
phabricator at mercurial-scm.org
Wed Sep 22 07:56:52 UTC 2021
Closed by commit rHG8655a77dce94: parser: force a `ValueError` to bytes before passing to `error.ParseError` (authored by mharbison72).
This revision was automatically updated to reflect the committed changes.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D11471?vs=30345&id=30363
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D11471/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D11471
AFFECTED FILES
mercurial/parser.py
CHANGE DETAILS
diff --git a/mercurial/parser.py b/mercurial/parser.py
--- a/mercurial/parser.py
+++ b/mercurial/parser.py
@@ -21,7 +21,6 @@
from .i18n import _
from . import (
error,
- pycompat,
util,
)
from .utils import stringutil
@@ -216,7 +215,11 @@
return stringutil.unescapestr(s)
except ValueError as e:
# mangle Python's exception into our format
- raise error.ParseError(pycompat.bytestr(e).lower())
+ # TODO: remove this suppression. For some reason, pytype 2021.09.09
+ # thinks .lower() is being called on Union[ValueError, bytes].
+ # pytype: disable=attribute-error
+ raise error.ParseError(stringutil.forcebytestr(e).lower())
+ # pytype: enable=attribute-error
def _prettyformat(tree, leafnodes, level, lines):
To: mharbison72, #hg-reviewers, Alphare
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210922/b238c15f/attachment-0002.html>
More information about the Mercurial-patches
mailing list