Backport fix for issue #10684 from 3.x
diff --git a/Lib/shutil.py b/Lib/shutil.py
index f2d2a90..9d922fb 100644
--- a/Lib/shutil.py
+++ b/Lib/shutil.py
@@ -277,6 +277,12 @@
     """
     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