Skip to content
Snippets Groups Projects
Commit 2506c3ac73f4 authored by Matt Harbison's avatar Matt Harbison
Browse files

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).
parent cc9a60050a07
No related branches found
No related tags found
2 merge requests!485branching: merge default into stable,!283Add basic type hints
...@@ -425,7 +425,7 @@ ...@@ -425,7 +425,7 @@
def __call__( def __call__(
self, self,
path: bytes, path: bytes,
mode: bytes = b"r", mode: bytes = b"rb",
atomictemp=False, atomictemp=False,
notindexed=False, notindexed=False,
backgroundclose=False, backgroundclose=False,
...@@ -612,7 +612,7 @@ ...@@ -612,7 +612,7 @@
def __init__(self, vfs: "vfs"): def __init__(self, vfs: "vfs"):
proxyvfs.__init__(self, 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'): if mode not in (b'r', b'rb'):
raise error.Abort(_(b'this vfs is read only')) raise error.Abort(_(b'this vfs is read only'))
return self.vfs(path, mode, *args, **kw) return self.vfs(path, mode, *args, **kw)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment