mercurial/util.py
changeset 51846 f5c46c3518a5
parent 51796 62806be5cbda
child 51859 f4733654f144
--- a/mercurial/util.py	Thu Sep 05 17:12:52 2024 -0400
+++ b/mercurial/util.py	Tue Mar 26 15:51:31 2024 +0000
@@ -333,8 +333,10 @@
 
     def buffer(sliceable, offset=0, length=None):
         if length is not None:
-            return memoryview(sliceable)[offset : offset + length]
-        return memoryview(sliceable)[offset:]
+            view = memoryview(sliceable)[offset : offset + length]
+        else:
+            view = memoryview(sliceable)[offset:]
+        return view.toreadonly()
 
 
 _chunksize = 4096