summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBarney Gale <barney.gale@gmail.com>2024-01-23 05:30:16 (GMT)
committerGitHub <noreply@github.com>2024-01-23 05:30:16 (GMT)
commitb822b85ac11e73bbe4417bf03ee770ab116bb42d (patch)
tree3d132b6977bf8d7b6345ac28297546610172e034
parent32c227470aa6f72950b76206ffc529c258b4b8fa (diff)
downloadcpython-b822b85ac11e73bbe4417bf03ee770ab116bb42d.zip
cpython-b822b85ac11e73bbe4417bf03ee770ab116bb42d.tar.gz
cpython-b822b85ac11e73bbe4417bf03ee770ab116bb42d.tar.bz2
GH-105900: Fix `pathlib.Path.symlink_to(target_is_directory=...)` docs (#114035)
Clarify that *target_is_directory* only matters if the target doesn't exist.
-rw-r--r--Doc/library/pathlib.rst10
1 files changed, 7 insertions, 3 deletions
diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst
index a6d99d4..fcbc0bf 100644
--- a/Doc/library/pathlib.rst
+++ b/Doc/library/pathlib.rst
@@ -1539,9 +1539,13 @@ call fails (for example because the path doesn't exist).
.. method:: Path.symlink_to(target, target_is_directory=False)
- Make this path a symbolic link to *target*. Under Windows,
- *target_is_directory* must be true (default ``False``) if the link's target
- is a directory. Under POSIX, *target_is_directory*'s value is ignored.
+ Make this path a symbolic link pointing to *target*.
+
+ On Windows, a symlink represents either a file or a directory, and does not
+ morph to the target dynamically. If the target is present, the type of the
+ symlink will be created to match. Otherwise, the symlink will be created
+ as a directory if *target_is_directory* is ``True`` or a file symlink (the
+ default) otherwise. On non-Windows platforms, *target_is_directory* is ignored.
::