Issue #27194: superfluous truncate calls in tarfile.py slow down extraction
Patch by Jason Fried.
This commit is contained in:
parent
b5ad54990f
commit
e7f27481a8
|
@ -2150,10 +2150,10 @@ class TarFile(object):
|
|||
for offset, size in tarinfo.sparse:
|
||||
target.seek(offset)
|
||||
copyfileobj(source, target, size, ReadError)
|
||||
target.seek(tarinfo.size)
|
||||
target.truncate()
|
||||
else:
|
||||
copyfileobj(source, target, tarinfo.size, ReadError)
|
||||
target.seek(tarinfo.size)
|
||||
target.truncate()
|
||||
|
||||
def makeunknown(self, tarinfo, targetpath):
|
||||
"""Make a file from a TarInfo object with an unknown type
|
||||
|
|
Loading…
Reference in New Issue