Mercurial > hg-stable
changeset 36081:223ed0b53f08
py3: more robustly cast UUID to bytes
The UUID type only has __str__ implemented. So we need to cast to
bytes on Python 3.
We need an actual bytes instance here (bytestr won't do) because
the re.escape() later iterates over characters and characters
need to behave like ints, not bytes instances of length 1.
Differential Revision: https://phab.mercurial-scm.org/D2144
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 11 Feb 2018 13:23:26 -0800 |
parents | 4fe2041007ed |
children | 3b4d14beac3d |
files | mercurial/sshpeer.py |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/sshpeer.py Sun Feb 11 13:09:16 2018 -0800 +++ b/mercurial/sshpeer.py Sun Feb 11 13:23:26 2018 -0800 @@ -220,7 +220,7 @@ # Generate a random token to help identify responses to version 2 # upgrade request. - token = bytes(uuid.uuid4()) + token = pycompat.sysbytes(str(uuid.uuid4())) upgradecaps = [ ('proto', wireprotoserver.SSHV2), ]