diff options
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(). |