[docs] [issue10436] tarfile.extractfile in "r|" stream mode fails with filenames or members from getmembers()
flying sheep
report at bugs.python.org
Tue May 9 09:08:51 EDT 2017
flying sheep added the comment:
well, we should just allow
extractall(members=['foo', 'bar'])
currently members only accepts TarInfo objects, not filenames, but it’s easy to accept both.
https://github.com/python/cpython/blob/74683fc6247c522ae955a6e7308b8ff51def35d8/Lib/tarfile.py#L1991-L1999
sth like:
filenames = set()
for member in members:
if isinstance(member, TarInfo):
# do what’s done now
else:
filenames.add(member)
for tarinfo in self:
if tarinfo.name in filenames:
self.extract(tarinfo)
----------
nosy: +flying sheep
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10436>
_______________________________________
More information about the docs
mailing list