mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
[3.11] bpo-26791: Update shutil.move() to provide the same symlink move behavior as the mv shell when moving a symlink into a directory that is the target of the symlink (GH-21759) (GH-113518)
(cherry picked from commit c66b577d9f
)
Co-authored-by: Jeffrey Kintscher <49998481+websurfer5@users.noreply.github.com>
This commit is contained in:
parent
a1f0118a26
commit
54927cd21a
3 changed files with 34 additions and 1 deletions
|
@ -837,7 +837,7 @@ def move(src, dst, copy_function=copy2):
|
|||
sys.audit("shutil.move", src, dst)
|
||||
real_dst = dst
|
||||
if os.path.isdir(dst):
|
||||
if _samefile(src, dst):
|
||||
if _samefile(src, dst) and not os.path.islink(src):
|
||||
# We might be on a case insensitive filesystem,
|
||||
# perform the rename anyway.
|
||||
os.rename(src, dst)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue