summaryrefslogtreecommitdiffstats
path: root/Doc/library/pathlib.rst
diff options
context:
space:
mode:
authorandrei kulakov <andrei.avk@gmail.com>2023-05-03 03:50:10 (GMT)
committerGitHub <noreply@github.com>2023-05-03 03:50:10 (GMT)
commitaf886ffa0612124598b5e8174c3b1be0f60eab38 (patch)
treee3e79405cb875e87b8cd5ce7574c0cbcd41748ca /Doc/library/pathlib.rst
parentc7c3a60c88de61a79ded9fdaf6bc6a29da4efb9a (diff)
downloadcpython-af886ffa0612124598b5e8174c3b1be0f60eab38.zip
cpython-af886ffa0612124598b5e8174c3b1be0f60eab38.tar.gz
cpython-af886ffa0612124598b5e8174c3b1be0f60eab38.tar.bz2
GH-89769: `pathlib.Path.glob()`: do not follow symlinks when checking for precise match (GH-29655)
Co-authored-by: Barney Gale <barney.gale@gmail.com>
Diffstat (limited to 'Doc/library/pathlib.rst')
-rw-r--r--Doc/library/pathlib.rst15
1 files changed, 9 insertions, 6 deletions
diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst
index 8e91936..4847ac2 100644
--- a/Doc/library/pathlib.rst
+++ b/Doc/library/pathlib.rst
@@ -819,9 +819,14 @@ call fails (for example because the path doesn't exist).
.. versionchanged:: 3.10
The *follow_symlinks* parameter was added.
-.. method:: Path.exists()
+.. method:: Path.exists(*, follow_symlinks=True)
- Whether the path points to an existing file or directory::
+ Return ``True`` if the path points to an existing file or directory.
+
+ This method normally follows symlinks; to check if a symlink exists, add
+ the argument ``follow_symlinks=False``.
+
+ ::
>>> Path('.').exists()
True
@@ -832,10 +837,8 @@ call fails (for example because the path doesn't exist).
>>> Path('nonexistentfile').exists()
False
- .. note::
- If the path points to a symlink, :meth:`exists` returns whether the
- symlink *points to* an existing file or directory.
-
+ .. versionchanged:: 3.12
+ The *follow_symlinks* parameter was added.
.. method:: Path.expanduser()