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 | e7f27481a895fb73408e523202345fcd9355b00c (patch) | |
tree | e3c747f8584a0e188ead6556f0553ccb295f8164 | |
parent | merge 3.4 (#26556) (diff) | |
download | cpython-e7f27481a895fb73408e523202345fcd9355b00c.tar.gz cpython-e7f27481a895fb73408e523202345fcd9355b00c.tar.bz2 cpython-e7f27481a895fb73408e523202345fcd9355b00c.zip |
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 86e1cf9b89c..721f9d7f918 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 diff --git a/Misc/ACKS b/Misc/ACKS index 001373b9406..be303e0e501 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -458,6 +458,7 @@ Stefan Franke Martin Franklin Kent Frazier Bruce Frederiksen +Jason Fried Robin Friedrich Bradley Froehle Ivan Frohne |