diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2022-03-09 12:29:33 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-09 12:29:33 (GMT) |
commit | 02fbaf4887deaf0207a5805d3736e0124a694c14 (patch) | |
tree | 347a9fc4b3c3150cf1a41eb2b765a7c8f1d5aa3c /Doc | |
parent | 5eb03b1b5124659ee63eac7bc03f76cf2c7f9439 (diff) | |
download | cpython-02fbaf4887deaf0207a5805d3736e0124a694c14.zip cpython-02fbaf4887deaf0207a5805d3736e0124a694c14.tar.gz cpython-02fbaf4887deaf0207a5805d3736e0124a694c14.tar.bz2 |
bpo-46245: Add optional parameter dir_fd in shutil.rmtree() (GH-30365)
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/shutil.rst | 10 | ||||
-rw-r--r-- | Doc/whatsnew/3.11.rst | 7 |
2 files changed, 15 insertions, 2 deletions
diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst index 22d6dba..16b8d3c 100644 --- a/Doc/library/shutil.rst +++ b/Doc/library/shutil.rst @@ -286,7 +286,7 @@ Directory and files operations .. versionadded:: 3.8 The *dirs_exist_ok* parameter. -.. function:: rmtree(path, ignore_errors=False, onerror=None) +.. function:: rmtree(path, ignore_errors=False, onerror=None, *, dir_fd=None) .. index:: single: directory; deleting @@ -296,6 +296,9 @@ Directory and files operations handled by calling a handler specified by *onerror* or, if that is omitted, they raise an exception. + This function can support :ref:`paths relative to directory descriptors + <dir_fd>`. + .. note:: On platforms that support the necessary fd-based functions a symlink @@ -315,7 +318,7 @@ Directory and files operations *excinfo*, will be the exception information returned by :func:`sys.exc_info`. Exceptions raised by *onerror* will not be caught. - .. audit-event:: shutil.rmtree path shutil.rmtree + .. audit-event:: shutil.rmtree path,dir_fd shutil.rmtree .. versionchanged:: 3.3 Added a symlink attack resistant version that is used automatically @@ -325,6 +328,9 @@ Directory and files operations On Windows, will no longer delete the contents of a directory junction before removing the junction. + .. versionchanged:: 3.11 + The *dir_fd* parameter. + .. attribute:: rmtree.avoids_symlink_attacks Indicates whether the current platform and implementation provides a diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index d9e5d06..628d4c0 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -283,6 +283,13 @@ os (Contributed by Dong-hee Na in :issue:`44611`.) +shutil +------ + +* Add optional parameter *dir_fd* in :func:`shutil.rmtree`. + (Contributed by Serhiy Storchaka in :issue:`46245`.) + + socket ------ |