Commit 20d02dc7 authored by Łukasz Langa's avatar Łukasz Langa

Issue #27194: superfluous truncate calls in tarfile.py slow down extraction

Patch by Jason Fried.
parent 2d065e33
......@@ -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
......
......@@ -458,6 +458,7 @@ Stefan Franke
Martin Franklin
Kent Frazier
Bruce Frederiksen
Jason Fried
Robin Friedrich
Bradley Froehle
Ivan Frohne
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment