diff options
author | Julien Palard <julien@palard.fr> | 2020-11-25 09:23:17 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-25 09:23:17 (GMT) |
commit | 4fedd7123eaf147edd55eabbbd72e0bcc8368e47 (patch) | |
tree | fc8ea4cf109b749c519ad1e86defde9ee8fbbfce /Lib/tarfile.py | |
parent | c9c6e9f89aa68ce8094393a1a5575b67d26bc8c8 (diff) | |
download | cpython-4fedd7123eaf147edd55eabbbd72e0bcc8368e47.zip cpython-4fedd7123eaf147edd55eabbbd72e0bcc8368e47.tar.gz cpython-4fedd7123eaf147edd55eabbbd72e0bcc8368e47.tar.bz2 |
bpo-12800: tarfile: Restore fix from 011525ee9 (GH-21409)
Restore fix from 011525ee92eb1c13ad1a62d28725a840e28f8160.
Diffstat (limited to 'Lib/tarfile.py')
-rwxr-xr-x | Lib/tarfile.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/tarfile.py b/Lib/tarfile.py index e422794..1d15612 100755 --- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -2237,6 +2237,9 @@ class TarFile(object): try: # For systems that support symbolic and hard links. if tarinfo.issym(): + if os.path.lexists(targetpath): + # Avoid FileExistsError on following os.symlink. + os.unlink(targetpath) os.symlink(tarinfo.linkname, targetpath) else: # See extract(). |