changeset 39063:1419ba5e3b56

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
author Augie Fackler <augie@google.com>
date Fri, 10 Aug 2018 03:16:02 -0400
parents efeeb73f54c3
children a2fa7247ca70
files mercurial/utils/stringutil.py
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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]