diff mercurial/extensions.py @ 46025:27c23c8f14da stable

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 e402a45261db
children 2cf61e66c6d0
line wrap: on
line diff
--- a/mercurial/extensions.py	Mon Nov 23 11:47:06 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