utils: accept bytearray arguments for escapestr
authorJoerg Sonnenberger <joerg@bec.de>
Wed, 28 Aug 2024 23:25:26 +0200
changeset 51832 4eccb65e444f
parent 51831 34eb3a711955
child 51834 454feddab720
utils: accept bytearray arguments for escapestr
mercurial/utils/stringutil.py
--- a/mercurial/utils/stringutil.py	Sun Jun 30 16:02:50 2024 +0200
+++ b/mercurial/utils/stringutil.py	Wed Aug 28 23:25:26 2024 +0200
@@ -724,7 +724,7 @@
 
 def escapestr(s: bytes) -> bytes:
     # "bytes" is also a typing shortcut for bytes, bytearray, and memoryview
-    if isinstance(s, memoryview):
+    if isinstance(s, (memoryview, bytearray)):
         s = bytes(s)
     # call underlying function of s.encode('string_escape') directly for
     # Python 3 compatibility