Issue #19856: shutil.move() failed to move a directory to other directory
on Windows if source name ends with os.altsep.
diff --git a/Lib/shutil.py b/Lib/shutil.py
index f8f0b7d..e12f791 100644
--- a/Lib/shutil.py
+++ b/Lib/shutil.py
@@ -259,7 +259,8 @@
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