summaryrefslogtreecommitdiff
path: root/Lib/shutil.py
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2015-07-25 14:55:06 +0300
committerBerker Peksag <berker.peksag@gmail.com>2015-07-25 14:55:06 +0300
commit940d69d4441393fc15f3418364d305cd683ad983 (patch)
treed5ecc72637dfabb4080fb8c5f3ba1e1e338142fe /Lib/shutil.py
parentbf1d4b6d7d3a997402535b4ab960b9373570a546 (diff)
parent5a294d822b7f5732135662907ec1a1d4a7b0fc9a (diff)
downloadcpython-git-940d69d4441393fc15f3418364d305cd683ad983.tar.gz
Issue #21697: shutil.copytree() now correctly handles symbolic links that point to directories.
Patch by Eduardo Seabra and Thomas Kluyver.
Diffstat (limited to 'Lib/shutil.py')
-rw-r--r--Lib/shutil.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/shutil.py b/Lib/shutil.py
index 61dc8045a9..a5da58790e 100644
--- a/Lib/shutil.py
+++ b/Lib/shutil.py
@@ -327,7 +327,11 @@ def copytree(src, dst, symlinks=False, ignore=None, copy_function=copy2,
if not os.path.exists(linkto) and ignore_dangling_symlinks:
continue
# otherwise let the copy occurs. copy2 will raise an error
- copy_function(srcname, dstname)
+ if os.path.isdir(srcname):
+ copytree(srcname, dstname, symlinks, ignore,
+ copy_function)
+ else:
+ copy_function(srcname, dstname)
elif os.path.isdir(srcname):
copytree(srcname, dstname, symlinks, ignore, copy_function)
else: