diff options
author | ?ukasz Langa <lukasz@langa.pl> | 2016-06-11 16:42:36 -0700 |
---|---|---|
committer | ?ukasz Langa <lukasz@langa.pl> | 2016-06-11 16:42:36 -0700 |
commit | 25927f9ca21939c018853b82d84fc0975954025f (patch) | |
tree | 08e24c52fed7cb1eeeeeb9720297bebf358e2b29 | |
parent | ed4554fc8b2c664c33761e93ef80c3cecdb4056d (diff) | |
download | cpython-25927f9ca21939c018853b82d84fc0975954025f.tar.gz |
Issue #27194: superfluous truncate calls in tarfile.py slow down extraction
Patch by Jason Fried.
-rwxr-xr-x | Lib/tarfile.py | 4 | ||||
-rw-r--r-- | Misc/ACKS | 1 |
2 files changed, 3 insertions, 2 deletions
diff --git a/Lib/tarfile.py b/Lib/tarfile.py index 86e1cf9b89..721f9d7f91 100755 --- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -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 |