diff --git a/tar_stream.py b/tar_stream.py index 4320a10be3bd2a48570099179d411b86d5012d40..38447044f613abbc2a551e64d6574b341b1d7995 100755 --- a/tar_stream.py +++ b/tar_stream.py @@ -35,6 +35,8 @@ class TarReader: mode='r|') pass for e in self.tarfile: + # For some reason tarfile is not set in entries... + e.tarfile = self.tarfile yield e # Keep memory consumption down self.tarfile.members = [] diff --git a/test/test_tar_stream.py b/test/test_tar_stream.py index 0e7b51f1693f07fff256f6c6ac15c44273380ee0..6e7a570f74d19f0588e03fd61bb86a459cfa69d0 100755 --- a/test/test_tar_stream.py +++ b/test/test_tar_stream.py @@ -29,7 +29,7 @@ def reader(tar_reader): for e in tar_reader: print('R', e.size, e.name) if e.isfile(): - a = tar_reader.tarfile.extractfile(e).read() + a = e.tarfile.extractfile(e).read() b = open(e.name, 'rb').read() if a != b: raise Exception('DIFFERS...', a, b)