Commit 9e86a83d authored by PJ Eby's avatar PJ Eby

Fix a problem with sandbox swapping 'open' and 'file' builtins.

Support sandbox access to os.devnull.

--HG--
branch : setuptools-0.6
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4080622
parent 16dc2a11
......@@ -105,8 +105,8 @@ class AbstractSandbox:
return func()
finally:
self._active = False
__builtin__.open = _file
__builtin__.file = _open
__builtin__.open = _open
__builtin__.file = _file
self._copy(_os)
def _mk_dual_path_wrapper(name):
......@@ -203,10 +203,10 @@ class DirectorySandbox(AbstractSandbox):
self._violation("open", path, mode, *args, **kw)
return _open(path,mode,*args,**kw)
def tmpnam(self):
self._violation("tmpnam")
def tmpnam(self): self._violation("tmpnam")
def _ok(self,path):
if hasattr(_os,'devnull') and path==_os.devnull: return True
active = self._active
try:
self._active = False
......
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