Commit 0be93889 authored by Jason R. Coombs's avatar Jason R. Coombs

Allow other arguments and kwargs to os.open when in the sandbox. Fixes Distribute #386.

parent fb535e22
...@@ -2,6 +2,12 @@ ...@@ -2,6 +2,12 @@
CHANGES CHANGES
======= =======
-----
0.9.1
-----
* Distribute #386: Allow other positional and keyword arguments to os.open.
--- ---
0.9 0.9
--- ---
......
...@@ -270,11 +270,11 @@ class DirectorySandbox(AbstractSandbox): ...@@ -270,11 +270,11 @@ class DirectorySandbox(AbstractSandbox):
self._violation(operation, src, dst, *args, **kw) self._violation(operation, src, dst, *args, **kw)
return (src,dst) return (src,dst)
def open(self, file, flags, mode=0x1FF): # 0777 def open(self, file, flags, mode=0x1FF, *args, **kw): # 0777
"""Called for low-level os.open()""" """Called for low-level os.open()"""
if flags & WRITE_FLAGS and not self._ok(file): if flags & WRITE_FLAGS and not self._ok(file):
self._violation("os.open", file, flags, mode) self._violation("os.open", file, flags, mode, *args, **kw)
return _os.open(file,flags,mode) return _os.open(file,flags,mode, *args, **kw)
WRITE_FLAGS = reduce( WRITE_FLAGS = reduce(
operator.or_, [getattr(_os, a, 0) for a in operator.or_, [getattr(_os, a, 0) for a in
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment