Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
3a308b9f
Commit
3a308b9f
authored
Feb 11, 2014
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #19856: shutil.move() failed to move a directory to other directory
on Windows if source name ends with os.altsep.
parent
c2f665e7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
1 deletion
+14
-1
Lib/shutil.py
Lib/shutil.py
+2
-1
Lib/test/test_shutil.py
Lib/test/test_shutil.py
+9
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/shutil.py
View file @
3a308b9f
...
...
@@ -484,7 +484,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
...
...
Lib/test/test_shutil.py
View file @
3a308b9f
...
...
@@ -1481,6 +1481,15 @@ class TestMove(unittest.TestCase):
# Move a dir inside an existing dir on another filesystem.
self
.
test_move_dir_to_dir
()
def
test_move_dir_sep_to_dir
(
self
):
self
.
_check_move_dir
(
self
.
src_dir
+
os
.
path
.
sep
,
self
.
dst_dir
,
os
.
path
.
join
(
self
.
dst_dir
,
os
.
path
.
basename
(
self
.
src_dir
)))
@
unittest
.
skipUnless
(
os
.
path
.
altsep
,
'requires os.path.altsep'
)
def
test_move_dir_altsep_to_dir
(
self
):
self
.
_check_move_dir
(
self
.
src_dir
+
os
.
path
.
altsep
,
self
.
dst_dir
,
os
.
path
.
join
(
self
.
dst_dir
,
os
.
path
.
basename
(
self
.
src_dir
)))
def
test_existing_file_inside_dest_dir
(
self
):
# A file with the same name inside the destination dir already exists.
with
open
(
self
.
dst_file
,
"wb"
):
...
...
Misc/NEWS
View file @
3a308b9f
...
...
@@ -20,6 +20,9 @@ Core and Builtins
Library
-------
- Issue #19856: shutil.move() failed to move a directory to other directory
on Windows if source name ends with os.altsep.
- Issue #14983: email.generator now always adds a line end after each MIME
boundary marker, instead of doing so only when there is an epilogue. This
fixes an RFC compliance bug and solves an issue with signed MIME parts.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment