From 6bffb57e636e2e1b6b5ee9c99a2bbd65c6ec9516 Mon Sep 17 00:00:00 2001 From: Anders Blomdell <anders.blomdell@control.lth.se> Date: Wed, 20 Jan 2021 18:03:15 +0100 Subject: [PATCH] Add missing tarfile to entries returned from tarfile... --- tar_stream.py | 2 ++ test/test_tar_stream.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tar_stream.py b/tar_stream.py index 4320a10..3844704 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 0e7b51f..6e7a570 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) -- GitLab