Skip to content

Commit f3269d9

Browse files
clarify that FileNotFoundError is a subclass of OSError
1 parent 2573a3a commit f3269d9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Doc/library/pathlib.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1624,12 +1624,12 @@ example because the path doesn't exist).
16241624
Remove this file or symbolic link. If the path points to a directory,
16251625
use :func:`Path.rmdir` instead.
16261626

1627-
This method propagates any :exc:`OSError` encountered during removal.
1628-
For example: If *missing_ok* is false (the default), :exc:`FileNotFoundError` is
1629-
raised if the path does not exist.
1627+
If *missing_ok* is false (the default), this method propagates any
1628+
:exc:`OSError` from the operating system, including :exc:`FileNotFoundError`.
16301629

16311630
If *missing_ok* is true, :exc:`FileNotFoundError` exceptions will be
1632-
ignored (same behavior as the POSIX ``rm -f`` command).
1631+
ignored (same behavior as the POSIX ``rm -f`` command), any other
1632+
:exc:`OSError` which is encountered will continue to be propogated.
16331633

16341634
.. versionchanged:: 3.8
16351635
The *missing_ok* parameter was added.

0 commit comments

Comments
 (0)