##// END OF EJS Templates
stringutil: if we get a memoryview in escapestr, coerce it to bytes...
Augie Fackler -
r39098:1419ba5e default
parent child Browse files
Show More
@@ -427,6 +427,8 b' def ellipsis(text, maxlength=400):'
427 return encoding.trim(text, maxlength, ellipsis='...')
427 return encoding.trim(text, maxlength, ellipsis='...')
428
428
429 def escapestr(s):
429 def escapestr(s):
430 if isinstance(s, memoryview):
431 s = bytes(s)
430 # call underlying function of s.encode('string_escape') directly for
432 # call underlying function of s.encode('string_escape') directly for
431 # Python 3 compatibility
433 # Python 3 compatibility
432 return codecs.escape_encode(s)[0]
434 return codecs.escape_encode(s)[0]
General Comments 0
You need to be logged in to leave comments. Login now