mirror of
https://github.com/python/cpython.git
synced 2025-08-15 22:30:42 +00:00
Fix closes issue10761: tarfile.extractall failure when symlinked files are present.
This commit is contained in:
parent
bdfa2e69e2
commit
011525ee92
3 changed files with 32 additions and 0 deletions
|
@ -2239,6 +2239,8 @@ class TarFile(object):
|
|||
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().
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue