Skip to content

Commit

Permalink
Issue python#27194: superfluous truncate calls in tarfile.py slow dow…
Browse files Browse the repository at this point in the history
…n extraction

Patch by Jason Fried.
  • Loading branch information
ambv committed Jun 11, 2016
1 parent b5ad549 commit e7f2748
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Lib/tarfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2150,10 +2150,10 @@ def makefile(self, tarinfo, targetpath):
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
Expand Down
1 change: 1 addition & 0 deletions Misc/ACKS
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ Stefan Franke
Martin Franklin
Kent Frazier
Bruce Frederiksen
Jason Fried
Robin Friedrich
Bradley Froehle
Ivan Frohne
Expand Down

0 comments on commit e7f2748

Please sign in to comment.