Commits

Hanno Schlichting committed 185058d

Applied patch from pjenvey. This closes #6.

Comments (0)

Files changed (1)

setuptools/sandbox.py

 import os, sys, __builtin__, tempfile, operator
 _os = sys.modules[os.name]
+_file = file
 _open = open
 from distutils.errors import DistutilsError
 __all__ = [
         """Run 'func' under os sandboxing"""
         try:
             self._copy(self)
-            __builtin__.open = __builtin__.file = self._open
+            __builtin__.file = self._file
+            __builtin__.open = self._open
             self._active = True
             return func()
         finally:
             self._active = False
-            __builtin__.open = __builtin__.file = _open
+            __builtin__.file = _file
+            __builtin__.open = _open
             self._copy(_os)
 
 
             return original(path,*args,**kw)
         return wrap
 
-    _open = _mk_single_path_wrapper('file', _open)
+    _file = _mk_single_path_wrapper('file', _file)
+    _open = _mk_single_path_wrapper('open', _open)
     for name in [
         "stat", "listdir", "chdir", "open", "chmod", "chown", "mkdir",
         "remove", "unlink", "rmdir", "utime", "lchown", "chroot", "lstat",