]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-95815: Document less specific error for os.remove (#99571)
authorRonald Oussoren <ronaldoussoren@mac.com>
Mon, 21 Nov 2022 10:08:06 +0000 (11:08 +0100)
committerGitHub <noreply@github.com>
Mon, 21 Nov 2022 10:08:06 +0000 (11:08 +0100)
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 #14262.

Doc/library/os.rst

index 0f0fb55e315c95213f6d314de5bbed64b62c16c3..3387d0842da8b6d03daa71cb045837a5e40d9aac 100644 (file)
@@ -2421,7 +2421,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