mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-74468: [tarfile] Fix incorrect name attribute of ExFileObject (GH-102424)
Co-authored-by: Simeon Visser <svisser@users.noreply.github.com>
This commit is contained in:
parent
89e67ada69
commit
56d055a0d8
3 changed files with 13 additions and 3 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue