Skip to content

Commit

Permalink
GH-95815: Document less specific error for os.remove (#99571)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ronaldoussoren authored Nov 21, 2022
1 parent cdde29d commit 1cae31d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Doc/library/os.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1cae31d

Please sign in to comment.