mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
[3.12] 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-113517)
(cherry picked from commit c66b577d9f
)
Co-authored-by: Jeffrey Kintscher <49998481+websurfer5@users.noreply.github.com>
This commit is contained in:
parent
b2ef35842c
commit
b8207711ce
3 changed files with 34 additions and 1 deletions
|
@ -870,7 +870,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