Index: Lib/importlib/_bootstrap.py =================================================================== --- Lib/importlib/_bootstrap.py (revision 84325) +++ Lib/importlib/_bootstrap.py (working copy) @@ -80,20 +80,6 @@ return _path_join(_os.getcwd(), path) -class _closing: - - """Simple replacement for contextlib.closing.""" - - def __init__(self, obj): - self.obj = obj - - def __enter__(self): - return self.obj - - def __exit__(self, *args): - self.obj.close() - - def _wrap(new, old): """Simple substitute for functools.wraps.""" for replace in ['__module__', '__name__', '__doc__']: @@ -468,7 +454,7 @@ def get_data(self, path): """Return the data from path as raw bytes.""" - with _closing(_io.FileIO(path, 'r')) as file: + with _io.FileIO(path, 'r') as file: return file.read() @@ -493,7 +479,7 @@ parent = _path_join(parent, part) try: _os.mkdir(parent) - except IOError as exc: + except EnvironmentError as exc: # Probably another Python process already created the dir. if exc.errno == errno.EEXIST: continue @@ -506,7 +492,7 @@ try: with _io.FileIO(path, 'wb') as file: file.write(data) - except IOError as exc: + except EnvironmentError as exc: # Don't worry if you can't write bytecode. if exc.errno == errno.EACCES: return