cpython: 26da299ca88e (original) (raw)

Mercurial > cpython

changeset 69869:26da299ca88e 3.1

Fix for issue 10684: Folders get deleted when trying to change case with shutil.move (case insensitive file systems only) [#10684]

Ronald Oussoren ronaldoussoren@mac.com
date Fri, 06 May 2011 10:23:04 +0200
parents 3aa51217492c
children f5aa0e52dd81 252451fef13f
files Lib/shutil.py Lib/test/test_shutil.py Misc/NEWS
diffstat 3 files changed, 29 insertions(+), 1 deletions(-)[+] [-] Lib/shutil.py 8 Lib/test/test_shutil.py 18 Misc/NEWS 4

line wrap: on

line diff

--- a/Lib/shutil.py +++ b/Lib/shutil.py @@ -260,12 +260,18 @@ def move(src, dst): """ real_dst = dst if os.path.isdir(dst):

+ 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)

--- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -522,6 +522,24 @@ class TestCopyFile(unittest.TestCase): self.assertTrue(srcfile._exited_with[0] is None) self.assertTrue(srcfile._raised)

+

+

+ + def test_main(): support.run_unittest(TestShutil, TestMove, TestCopyFile)

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -66,6 +66,10 @@ Core and Builtins Library ------- +- Issue #10684: shutil.move used to delete a folder on case insensitive