stringutil: if we get a memoryview in escapestr, coerce it to bytes
Otherwise we get an exception. Sadly, this manifesting deep inside the
wireproto code, inside a future. For some reason the exception was
/causing a hang/ rather than actually propagating out, which seems
like it might merit some investigation in the future.
Differential Revision: https://phab.mercurial-scm.org/D4256
--- a/mercurial/utils/stringutil.py Fri Aug 10 03:14:52 2018 -0400
+++ b/mercurial/utils/stringutil.py Fri Aug 10 03:16:02 2018 -0400
@@ -427,6 +427,8 @@
return encoding.trim(text, maxlength, ellipsis='...')
def escapestr(s):
+ if isinstance(s, memoryview):
+ s = bytes(s)
# call underlying function of s.encode('string_escape') directly for
# Python 3 compatibility
return codecs.escape_encode(s)[0]