Fix "AttributeError: 'TarFile' object has no attribute '__exit__'" with Python 3.1.

parent 57fb24d6
...@@ -8,4 +8,7 @@ def _tarfile_open_ex(*args, **kwargs): ...@@ -8,4 +8,7 @@ def _tarfile_open_ex(*args, **kwargs):
""" """
return contextlib.closing(tarfile.open(*args, **kwargs)) return contextlib.closing(tarfile.open(*args, **kwargs))
tarfile_open = _tarfile_open_ex if sys.version_info < (2,7) else tarfile.open if sys.version_info[:2] < (2, 7) or (3, 0) <= sys.version_info[:2] < (3, 2):
tarfile_open = _tarfile_open_ex
else:
tarfile_open = tarfile.open
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment