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

Skip to content

Commit b822b85

Browse files
authored
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.
1 parent 32c2274 commit b822b85

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
@@ -1539,9 +1539,13 @@ call fails (for example because the path doesn't exist).
15391539

15401540
.. method:: Path.symlink_to(target, target_is_directory=False)
15411541

1542-
Make this path a symbolic link to *target*. Under Windows,
1543-
*target_is_directory* must be true (default ``False``) if the link's target
1544-
is a directory. Under POSIX, *target_is_directory*'s value is ignored.
1542+
Make this path a symbolic link pointing to *target*.
1543+
1544+
On Windows, a symlink represents either a file or a directory, and does not
1545+
morph to the target dynamically. If the target is present, the type of the
1546+
symlink will be created to match. Otherwise, the symlink will be created
1547+
as a directory if *target_is_directory* is ``True`` or a file symlink (the
1548+
default) otherwise. On non-Windows platforms, *target_is_directory* is ignored.
15451549

15461550
::
15471551

0 commit comments

Comments
 (0)