[Python-checkins] GH-95815: Document less specific error for os.remove (#99571)
ronaldoussoren
webhook-mailer at python.org
Mon Nov 21 05:08:23 EST 2022
https://github.com/python/cpython/commit/1cae31d26ba621f6b1f0656ad3d69a0236338bad
commit: 1cae31d26ba621f6b1f0656ad3d69a0236338bad
branch: main
author: Ronald Oussoren <ronaldoussoren at mac.com>
committer: ronaldoussoren <ronaldoussoren at mac.com>
date: 2022-11-21T11:08:06+01:00
summary:
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.
files:
M Doc/library/os.rst
diff --git a/Doc/library/os.rst b/Doc/library/os.rst
index 0f0fb55e315c..3387d0842da8 100644
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -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
More information about the Python-checkins
mailing list