diff options
author | Oleg Iarygin <oleg@arhadthedev.net> | 2023-03-27 23:21:07 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-27 23:21:07 (GMT) |
commit | 56d055a0d81a809e4ff8e1d56756a3bf32317efb (patch) | |
tree | a7b12f88c2a8496a23b3ab41d60836bf8e8b1c66 /Lib/tarfile.py | |
parent | 89e67ada6958cfd8d4eec221848f81b2619de099 (diff) | |
download | cpython-56d055a0d81a809e4ff8e1d56756a3bf32317efb.zip cpython-56d055a0d81a809e4ff8e1d56756a3bf32317efb.tar.gz cpython-56d055a0d81a809e4ff8e1d56756a3bf32317efb.tar.bz2 |
gh-74468: [tarfile] Fix incorrect name attribute of ExFileObject (GH-102424)
Co-authored-by: Simeon Visser <svisser@users.noreply.github.com>
Diffstat (limited to 'Lib/tarfile.py')
-rwxr-xr-x | Lib/tarfile.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/tarfile.py b/Lib/tarfile.py index d686435..b733195 100755 --- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -601,12 +601,12 @@ class _FileInFile(object): object. """ - def __init__(self, fileobj, offset, size, blockinfo=None): + def __init__(self, fileobj, offset, size, name, blockinfo=None): self.fileobj = fileobj self.offset = offset self.size = size self.position = 0 - self.name = getattr(fileobj, "name", None) + self.name = name self.closed = False if blockinfo is None: @@ -703,7 +703,7 @@ class ExFileObject(io.BufferedReader): def __init__(self, tarfile, tarinfo): fileobj = _FileInFile(tarfile.fileobj, tarinfo.offset_data, - tarinfo.size, tarinfo.sparse) + tarinfo.size, tarinfo.name, tarinfo.sparse) super().__init__(fileobj) #class ExFileObject |