Issue #19856: shutil.move() failed to move a directory to other directory

on Windows if source name ends with os.altsep.
This commit is contained in:
Serhiy Storchaka 2014-02-11 10:32:41 +02:00
commit 6a45021084
3 changed files with 14 additions and 1 deletions

View file

@ -483,7 +483,8 @@ rmtree.avoids_symlink_attacks = _use_fd_functions
def _basename(path):
# A basename() variant which first strips the trailing slash, if present.
# Thus we always get the last component of the path, even for directories.
return os.path.basename(path.rstrip(os.path.sep))
sep = os.path.sep + (os.path.altsep or '')
return os.path.basename(path.rstrip(sep))
def move(src, dst):
"""Recursively move a file or directory to another location. This is