summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2016-11-09 20:58:31 (GMT)
committerSteve Dower <steve.dower@microsoft.com>2016-11-09 20:58:31 (GMT)
commitbb132fc34ef2aeaf4cbe9a37b3f70833e088c6a0 (patch)
tree219c1d9f5f7786c17bfd1bc83cad69a2e8caa1f0 /Doc
parent02f252f3af496f297dc8fc1f35a0634a686612a2 (diff)
parent98eb360531e5e3045b21b34afd32474cf8741c9b (diff)
downloadcpython-bb132fc34ef2aeaf4cbe9a37b3f70833e088c6a0.zip
cpython-bb132fc34ef2aeaf4cbe9a37b3f70833e088c6a0.tar.gz
cpython-bb132fc34ef2aeaf4cbe9a37b3f70833e088c6a0.tar.bz2
Issue #19717: Makes Path.resolve() succeed on paths that do not exist (patch by Vajrasky Kok)
Diffstat (limited to 'Doc')
-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)