commit | 011525ee92eb1c13ad1a62d28725a840e28f8160 | [log] [tgz] |
---|---|---|
author | Senthil Kumaran <orsenthil@gmail.com> | Thu Apr 28 15:30:31 2011 +0800 |
committer | Senthil Kumaran <orsenthil@gmail.com> | Thu Apr 28 15:30:31 2011 +0800 |
tree | 591e0d6f8823bd6970efc227ca1c42968c47d8ad | |
parent | bdfa2e69e22adf4d5f74f77938f5371f2cbbf241 [diff] [blame] |
Fix closes issue10761: tarfile.extractall failure when symlinked files are present.
diff --git a/Lib/tarfile.py b/Lib/tarfile.py index 47be1d4..105a758 100644 --- a/Lib/tarfile.py +++ b/Lib/tarfile.py
@@ -2239,6 +2239,8 @@ if hasattr(os, "symlink") and hasattr(os, "link"): # For systems that support symbolic and hard links. if tarinfo.issym(): + if os.path.exists(targetpath): + os.unlink(targetpath) os.symlink(tarinfo.linkname, targetpath) else: # See extract().