Mercurial > public > mercurial-scm > hg
diff mercurial/extensions.py @ 45947:3db545fccac1
extensions: avoid a crash when the version isn't properly byteified on py3
We already force bytestr on the `testedwith` and `buglink` attributes in
dispatch.py when generating a bug report with a similar comment about not
every extension being ported to py3. We should do the same here, so the
function can be properly typed.
Differential Revision: https://phab.mercurial-scm.org/D9433
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Fri, 27 Nov 2020 14:54:37 -0500 |
parents | 89a2afe31e82 |
children | 2cf61e66c6d0 |
line wrap: on
line diff
--- a/mercurial/extensions.py Fri Nov 27 19:35:37 2020 -0500 +++ b/mercurial/extensions.py Fri Nov 27 14:54:37 2020 -0500 @@ -936,6 +936,10 @@ version = b'' if isinstance(version, (list, tuple)): version = b'.'.join(pycompat.bytestr(o) for o in version) + else: + # version data should be bytes, but not all extensions are ported + # to py3. + version = stringutil.forcebytestr(version) return version