From cd4aab1dff5f40aeaa08174a05f15527f67f66d4 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Tue, 30 Dec 2014 10:04:27 -0500 Subject: Include __enter__ in shim --- setuptools/tests/py26compat.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'setuptools/tests/py26compat.py') diff --git a/setuptools/tests/py26compat.py b/setuptools/tests/py26compat.py index 24e6dbe2..ead72fa6 100644 --- a/setuptools/tests/py26compat.py +++ b/setuptools/tests/py26compat.py @@ -17,10 +17,11 @@ except AttributeError: def _tarfile_open_ex(*args, **kwargs): """ - Extend result with an __exit__ to close the file. + Extend result as a context manager. """ res = tarfile.open(*args, **kwargs) res.__exit__ = lambda self: self.close() + res.__enter__ = lambda self: self return res tarfile_open = _tarfile_open_ex if sys.version_info < (2,7) else tarfile.open -- cgit v1.2.1