Skip to content

Commit 1cae31d

Browse files
GH-95815: Document less specific error for os.remove (#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 #14262.
1 parent cdde29d commit 1cae31d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: Doc/library/os.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -2421,7 +2421,7 @@ features:
24212421
.. function:: remove(path, *, dir_fd=None)
24222422

24232423
Remove (delete) the file *path*. If *path* is a directory, an
2424-
:exc:`IsADirectoryError` is raised. Use :func:`rmdir` to remove directories.
2424+
:exc:`OSError` is raised. Use :func:`rmdir` to remove directories.
24252425
If the file does not exist, a :exc:`FileNotFoundError` is raised.
24262426

24272427
This function can support :ref:`paths relative to directory descriptors

0 commit comments

Comments
 (0)