diff options
author | Florent Xicluna <florent.xicluna@gmail.com> | 2010-09-03 19:55:26 (GMT) |
---|---|---|
committer | Florent Xicluna <florent.xicluna@gmail.com> | 2010-09-03 19:55:26 (GMT) |
commit | 764d612f5e4d7d3c27e3f1a1eef661e9e556082e (patch) | |
tree | 6340b822deb01e2be6d9f7e93c1a227cc993573c | |
parent | 43e4ea1b17ac912e4f8e55e256b96be0c57a88ee (diff) | |
download | cpython-764d612f5e4d7d3c27e3f1a1eef661e9e556082e.zip cpython-764d612f5e4d7d3c27e3f1a1eef661e9e556082e.tar.gz cpython-764d612f5e4d7d3c27e3f1a1eef661e9e556082e.tar.bz2 |
Remove redundant context manager.
-rw-r--r-- | Lib/importlib/_bootstrap.py | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py index 9130a92..1a37a89 100644 --- a/Lib/importlib/_bootstrap.py +++ b/Lib/importlib/_bootstrap.py @@ -80,20 +80,6 @@ def _path_absolute(path): 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 @@ class _FileLoader: 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() |