mirror of
https://github.com/python/cpython.git
synced 2025-12-10 11:00:14 +00:00
bpo-12800: tarfile: Restore fix from 011525ee9 (GH-21409)
Restore fix from 011525ee92.
This commit is contained in:
parent
c9c6e9f89a
commit
4fedd7123e
3 changed files with 10 additions and 3 deletions
|
|
@ -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().
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue