summaryrefslogtreecommitdiffstats
path: root/Lib/shutil.py
diff options
context:
space:
mode:
authorRonald Oussoren <ronaldoussoren@mac.com>2011-05-06 08:57:22 (GMT)
committerRonald Oussoren <ronaldoussoren@mac.com>2011-05-06 08:57:22 (GMT)
commit78349b06af6cabe7ff949a98fafa15d8a9c48c61 (patch)
tree5b5006f315051a971e137c32285164a858fe3f13 /Lib/shutil.py
parent8cd2e5f7512424354d2b3a05115d906d2def237a (diff)
parentf51738b10e83d0adf404ca989970a5b44700d685 (diff)
downloadcpython-78349b06af6cabe7ff949a98fafa15d8a9c48c61.zip
cpython-78349b06af6cabe7ff949a98fafa15d8a9c48c61.tar.gz
cpython-78349b06af6cabe7ff949a98fafa15d8a9c48c61.tar.bz2
merge from 3.1
Diffstat (limited to 'Lib/shutil.py')
-rw-r--r--Lib/shutil.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/shutil.py b/Lib/shutil.py
index aafe04e..d2e2dc5 100644
--- a/Lib/shutil.py
+++ b/Lib/shutil.py
@@ -311,12 +311,18 @@ def move(src, dst):
"""
real_dst = dst
if os.path.isdir(dst):
+ if _samefile(src, dst):
+ # We might be on a case insensitive filesystem,
+ # perform the rename anyway.
+ os.rename(src, dst)
+ return
+
real_dst = os.path.join(dst, _basename(src))
if os.path.exists(real_dst):
raise Error("Destination path '%s' already exists" % real_dst)
try:
os.rename(src, real_dst)
- except OSError:
+ except OSError as exc:
if os.path.isdir(src):
if _destinsrc(src, dst):
raise Error("Cannot move a directory '%s' into itself '%s'." % (src, dst))