https://github.com/python/cpython/commit/2c24bc1b6ea3fa135634db9d0c336d67b1d42ef9
commit: 2c24bc1b6ea3fa135634db9d0c336d67b1d42ef9
branch: main
author: Gregory P. Smith <[email protected]>
committer: gpshead <[email protected]>
date: 2026-10-23T01:12:35+02:00
summary:

gh-160322: document shutil.rmtree("link/") symlink following behavior 
(GH-160372)

files:
M Doc/library/shutil.rst

diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst
index f1695a2055913a..8f3c90719a9a15 100644
--- a/Doc/library/shutil.rst
+++ b/Doc/library/shutil.rst
@@ -325,6 +325,12 @@ Directory and files operations
    handled by calling a handler specified by *onexc* or *onerror* or, if both
    are omitted, exceptions are propagated to the caller.
 
+   If *path* is a symbolic link to a directory followed by a trailing path
+   separator, such as ``'link/'``, the operating system resolves the link, so
+   :func:`!rmtree` deletes the contents of the directory it points to and then
+   fails to remove *path* itself.  :class:`pathlib.Path` strips trailing
+   separators, so ``rmtree(Path('link/'))`` refuses the link as usual.
+
    This function can support :ref:`paths relative to directory descriptors
    <dir_fd>`.
 

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to