mirror of
https://github.com/python/cpython.git
synced 2025-07-12 13:55:34 +00:00
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:
commit
6a45021084
3 changed files with 14 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue