Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f6d09c0
GH-73991: Add `pathlib.Path.move()`
barneygale Jul 21, 2024
1dc0bfb
Simplify slightly
barneygale Jul 21, 2024
f488ff8
Test existing files/directories as destinations.
barneygale Jul 21, 2024
ff7746f
rename --> replace
barneygale Jul 21, 2024
29e51f5
Windows test fixes
barneygale Jul 21, 2024
36955ab
Revert "Windows test fixes"
barneygale Jul 21, 2024
d595047
Handle existing targets more consistently
barneygale Jul 21, 2024
5de963e
Use generic implementation on ERROR_ACCESS_DENIED.
barneygale Jul 21, 2024
e1c0d9e
Expand test coverage, lean into the Windows differences a bit.
barneygale Jul 22, 2024
a98aed4
Loosen tests for OSError types.
barneygale Jul 22, 2024
0af6396
Revert "Loosen tests for OSError types."
barneygale Jul 22, 2024
348cabd
Tweaks
barneygale Jul 22, 2024
aca70d1
Relax expectations once again.
barneygale Jul 22, 2024
aa27f48
skip tests affected by apparent os.replace() inconsistency
barneygale Jul 22, 2024
04b115a
More compatibility experiments.
barneygale Jul 22, 2024
be48d2a
Cunningly avoid specifying the problematic cases.
barneygale Jul 22, 2024
a5ee60a
Fix moving a file/directory to itself.
barneygale Jul 22, 2024
f9219ee
Undo unnecessary change
barneygale Jul 22, 2024
5ad2c1d
Ensure we exit from copytree() when copying directory over itself.
barneygale Jul 27, 2024
46b1fc2
Merge branch 'main' into path-move
barneygale Aug 7, 2024
d889dff
Merge branch 'main' into path-move
barneygale Aug 11, 2024
9d92108
Docs tweak
barneygale Aug 11, 2024
92cc785
Set `filename` and `filename2` in error messages.
barneygale Aug 11, 2024
b8372aa
Simplify patch
barneygale Aug 11, 2024
8199fd5
Undo changes from GH-122924.
barneygale Aug 13, 2024
175d687
Merge branch 'main' into path-move
barneygale Aug 23, 2024
8182a88
Merge branch 'main' into path-move
barneygale Aug 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rename --> replace
  • Loading branch information
barneygale committed Jul 21, 2024
commit ff7746f9549e3997f34b221351ae2d55ecdecacd
2 changes: 1 addition & 1 deletion Doc/library/pathlib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1598,7 +1598,7 @@ Copying, moving and deleting
return a new :class:`!Path` instance pointing to *target*.

If both paths are on the same filesystem, the move is performed with
:func:`os.rename`. Otherwise, this path is copied (preserving metadata and
:func:`os.replace`. Otherwise, this path is copied (preserving metadata and
Comment thread
picnixz marked this conversation as resolved.
Outdated
symlinks) and then deleted.

.. versionadded:: 3.14
Expand Down
2 changes: 1 addition & 1 deletion Lib/pathlib/_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ def move(self, target):
"""

try:
return self.rename(target)
return self.replace(target)
except TypeError:
if not isinstance(target, PathBase):
raise
Expand Down