summaryrefslogtreecommitdiffstats
path: root/Doc/library/pathlib.rst
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2016-11-09 20:58:17 (GMT)
committerSteve Dower <steve.dower@microsoft.com>2016-11-09 20:58:17 (GMT)
commit98eb360531e5e3045b21b34afd32474cf8741c9b (patch)
treea73359433985b57325b2d4107c5790bdf2b091fd /Doc/library/pathlib.rst
parent954c7dd0ccbe01668856d6a9816aeb1fe07bce7e (diff)
downloadcpython-98eb360531e5e3045b21b34afd32474cf8741c9b.zip
cpython-98eb360531e5e3045b21b34afd32474cf8741c9b.tar.gz
cpython-98eb360531e5e3045b21b34afd32474cf8741c9b.tar.bz2
Issue #19717: Makes Path.resolve() succeed on paths that do not exist (patch by Vajrasky Kok)
Diffstat (limited to 'Doc/library/pathlib.rst')
-rw-r--r--Doc/library/pathlib.rst12
1 files changed, 8 insertions, 4 deletions
diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst
index 5a81917..34ab3b8 100644
--- a/Doc/library/pathlib.rst
+++ b/Doc/library/pathlib.rst
@@ -919,7 +919,7 @@ call fails (for example because the path doesn't exist):
to an existing file or directory, it will be unconditionally replaced.
-.. method:: Path.resolve()
+.. method:: Path.resolve(strict=False)
Make the path absolute, resolving any symlinks. A new path object is
returned::
@@ -936,10 +936,14 @@ call fails (for example because the path doesn't exist):
>>> p.resolve()
PosixPath('/home/antoine/pathlib/setup.py')
- If the path doesn't exist, :exc:`FileNotFoundError` is raised. If an
- infinite loop is encountered along the resolution path,
- :exc:`RuntimeError` is raised.
+ If the path doesn't exist and *strict* is ``True``, :exc:`FileNotFoundError`
+ is raised. If *strict* is ``False``, the path is resolved as far as possible
+ and any remainder is appended without checking whether it exists. If an
+ infinite loop is encountered along the resolution path, :exc:`RuntimeError`
+ is raised.
+ .. versionadded:: 3.6
+ The *strict* argument.
.. method:: Path.rglob(pattern)