Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1f04ac8

Browse files
[3.11] GH-105900: Fix pathlib.Path.symlink_to(target_is_directory=...) docs (GH-114035) (#114465)
Clarify that *target_is_directory* only matters if the target doesn't exist. (cherry picked from commit b822b85) Co-authored-by: Barney Gale <[email protected]>
1 parent 9d2ad6f commit 1f04ac8

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Doc/library/pathlib.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,9 +1187,13 @@ call fails (for example because the path doesn't exist).
11871187

11881188
.. method:: Path.symlink_to(target, target_is_directory=False)
11891189

1190-
Make this path a symbolic link to *target*. Under Windows,
1191-
*target_is_directory* must be true (default ``False``) if the link's target
1192-
is a directory. Under POSIX, *target_is_directory*'s value is ignored.
1190+
Make this path a symbolic link pointing to *target*.
1191+
1192+
On Windows, a symlink represents either a file or a directory, and does not
1193+
morph to the target dynamically. If the target is present, the type of the
1194+
symlink will be created to match. Otherwise, the symlink will be created
1195+
as a directory if *target_is_directory* is ``True`` or a file symlink (the
1196+
default) otherwise. On non-Windows platforms, *target_is_directory* is ignored.
11931197

11941198
::
11951199

0 commit comments

Comments
 (0)