diff options
author | PJ Eby <distutils-sig@python.org> | 2010-04-29 16:09:17 +0000 |
---|---|---|
committer | PJ Eby <distutils-sig@python.org> | 2010-04-29 16:09:17 +0000 |
commit | 9e86a83d9b16147dfda3ae2d74c2ed82c1c893a7 (patch) | |
tree | 0890b2e3dd6df075aef281717d581dac6ac18847 | |
parent | 16dc2a11fb1b33955ad55ab00f186fcc909e35f6 (diff) | |
download | external_python_setuptools-9e86a83d9b16147dfda3ae2d74c2ed82c1c893a7.tar.gz external_python_setuptools-9e86a83d9b16147dfda3ae2d74c2ed82c1c893a7.tar.bz2 external_python_setuptools-9e86a83d9b16147dfda3ae2d74c2ed82c1c893a7.zip |
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
-rwxr-xr-x | setuptools/sandbox.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py index 00eb0124..4c5e7129 100755 --- a/setuptools/sandbox.py +++ b/setuptools/sandbox.py @@ -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 |