]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] GH-95815: Document less specific error for os.remove (GH-99571) (#99641)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 21 Nov 2022 11:04:55 +0000 (03:04 -0800)
committerGitHub <noreply@github.com>
Mon, 21 Nov 2022 11:04:55 +0000 (12:04 +0100)
GH-95815: Document less specific error for os.remove (GH-99571)

os.remove can raise PermissionError instead of IsADirectoryError,
when the object to be removed is a directory (in particular on
macOS).

This reverts a change done in GH-14262.
(cherry picked from commit 1cae31d26ba621f6b1f0656ad3d69a0236338bad)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
Doc/library/os.rst

index 74125aef05793e47309342a3c9c1deda54a8d3d6..6df697d446071d0afd3b57d7f2491ea1f4d00ec3 100644 (file)
@@ -2326,7 +2326,7 @@ features:
 .. function:: remove(path, *, dir_fd=None)
 
    Remove (delete) the file *path*.  If *path* is a directory, an
-   :exc:`IsADirectoryError` is raised.  Use :func:`rmdir` to remove directories.
+   :exc:`OSError` is raised.  Use :func:`rmdir` to remove directories.
    If the file does not exist, a :exc:`FileNotFoundError` is raised.
 
    This function can support :ref:`paths relative to directory descriptors