summaryrefslogtreecommitdiffstats
path: root/Lib/pathlib.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/pathlib.py')
-rw-r--r--Lib/pathlib.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/pathlib.py b/Lib/pathlib.py
index 80923c7..7bd66c1 100644
--- a/Lib/pathlib.py
+++ b/Lib/pathlib.py
@@ -1341,20 +1341,24 @@ class Path(PurePath):
def rename(self, target):
"""
- Rename this path to the given path.
+ Rename this path to the given path,
+ and return a new Path instance pointing to the given path.
"""
if self._closed:
self._raise_closed()
self._accessor.rename(self, target)
+ return self.__class__(target)
def replace(self, target):
"""
Rename this path to the given path, clobbering the existing
- destination if it exists.
+ destination if it exists, and return a new Path instance
+ pointing to the given path.
"""
if self._closed:
self._raise_closed()
self._accessor.replace(self, target)
+ return self.__class__(target)
def symlink_to(self, target, target_is_directory=False):
"""