changeset 51874:4eccb65e444f

utils: accept bytearray arguments for escapestr
author Joerg Sonnenberger <joerg@bec.de>
date Wed, 28 Aug 2024 23:25:26 +0200
parents 34eb3a711955
children 454feddab720
files mercurial/utils/stringutil.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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