changeset 49574:2506c3ac73f4

vfs: make the default opener mode binary The default was already binary for `abstractvfs`, and the `vfs` implementation adds binary mode if the caller didn't supply it. Therefore, it should be safe for all vfs objects (and I don't think we want text reads anyway).
author Matt Harbison <matt_harbison@yahoo.com>
date Fri, 04 Nov 2022 17:54:43 -0400
parents cc9a60050a07
children bbbb5213d043
files mercurial/vfs.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/vfs.py	Wed Nov 02 17:30:57 2022 -0400
+++ b/mercurial/vfs.py	Fri Nov 04 17:54:43 2022 -0400
@@ -425,7 +425,7 @@
     def __call__(
         self,
         path: bytes,
-        mode: bytes = b"r",
+        mode: bytes = b"rb",
         atomictemp=False,
         notindexed=False,
         backgroundclose=False,
@@ -612,7 +612,7 @@
     def __init__(self, vfs: "vfs"):
         proxyvfs.__init__(self, vfs)
 
-    def __call__(self, path: bytes, mode: bytes = b'r', *args, **kw):
+    def __call__(self, path: bytes, mode: bytes = b'rb', *args, **kw):
         if mode not in (b'r', b'rb'):
             raise error.Abort(_(b'this vfs is read only'))
         return self.vfs(path, mode, *args, **kw)