]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] GH-105900: Fix `pathlib.Path.symlink_to(target_is_directory=...)` docs (GH...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 23 Jan 2024 05:36:16 +0000 (06:36 +0100)
committerGitHub <noreply@github.com>
Tue, 23 Jan 2024 05:36:16 +0000 (05:36 +0000)
Clarify that *target_is_directory* only matters if the target doesn't
exist.
(cherry picked from commit b822b85ac11e73bbe4417bf03ee770ab116bb42d)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
Doc/library/pathlib.rst

index 345a974dcb10bd874c975637b2524f25b1b728be..d839557993742a9af4a7073cc22e58a187925469 100644 (file)
@@ -1387,9 +1387,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.
 
    ::