8000 gh-119993 ignore `NotADirectoryError` in `Path.unlink()` if `missing_ok` is `True` by MusicalNinjaDad · Pull Request #120049 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-119993 ignore NotADirectoryError in Path.unlink() if missing_ok is True #120049

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add a comment on when NotADirectoryErroris raised by Path.unlink()
  • Loading branch information
MusicalNinjaDad committed Jun 4, 2024
commit e80568d0af6f8cb663e12c4c625e669445164c24
3 changes: 3 additions & 0 deletions Doc/library/pathlib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1630,6 +1630,9 @@ example because the path doesn't exist).
If *missing_ok* is true, :exc:`FileNotFoundError` exceptions will be
ignored (same behavior as the POSIX ``rm -f`` command).

If an intermediate part of the path points to a file,
:exc:`NotADirectoryError` will be raised.

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

Expand Down
0