[Python-checkins] r80622 - sandbox/branches/setuptools-0.6/setuptools/sandbox.py
phillip.eby
python-checkins at python.org
Thu Apr 29 18:09:17 CEST 2010
Author: phillip.eby
Date: Thu Apr 29 18:09:17 2010
New Revision: 80622
Log:
Fix a problem with sandbox swapping 'open' and 'file' builtins.
Support sandbox access to os.devnull.
Modified:
sandbox/branches/setuptools-0.6/setuptools/sandbox.py
Modified: sandbox/branches/setuptools-0.6/setuptools/sandbox.py
==============================================================================
--- sandbox/branches/setuptools-0.6/setuptools/sandbox.py (original)
+++ sandbox/branches/setuptools-0.6/setuptools/sandbox.py Thu Apr 29 18:09:17 2010
@@ -105,8 +105,8 @@
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 @@
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
More information about the Python-checkins
mailing list