##// END OF EJS Templates
util: teach escapedata() about bytearray...
Gregory Szorc -
r36647:c98d1c67 default
parent child Browse files
Show More
@@ -702,6 +702,9 b' DATA_ESCAPE_MAP.update({'
702 DATA_ESCAPE_RE = remod.compile(br'[\x00-\x08\x0a-\x1f\\\x7f-\xff]')
702 DATA_ESCAPE_RE = remod.compile(br'[\x00-\x08\x0a-\x1f\\\x7f-\xff]')
703
703
704 def escapedata(s):
704 def escapedata(s):
705 if isinstance(s, bytearray):
706 s = bytes(s)
707
705 return DATA_ESCAPE_RE.sub(lambda m: DATA_ESCAPE_MAP[m.group(0)], s)
708 return DATA_ESCAPE_RE.sub(lambda m: DATA_ESCAPE_MAP[m.group(0)], s)
706
709
707 class fileobjectobserver(object):
710 class fileobjectobserver(object):
General Comments 0
You need to be logged in to leave comments. Login now