{{ message }}
bpo-33123: pathlib: Add missing_ok parameter to Path.unlink - #6191
Merged
Merged
Conversation
rbu
force-pushed
the
pathlib-unlink-missing-ok
branch
from
March 22, 2018 18:14
2e2506a to
6d6f2e9
Compare
Contributor
Author
|
CLA is signed and submitted. |
amirouche
reviewed
Apr 3, 2018
There was a problem hiding this comment.
I don't think it's worth changing the name of the file to something sort of explicit such as fileMissing. I'd rather not surprise the reader and use what seems the default in the tests file ie. fileA here too.
WDYT?
Contributor
Author
There was a problem hiding this comment.
Agreed. fileA actually exists, but I changed to fileAAA which seems to be used for a non-existing file in other tests.
rbu
force-pushed
the
pathlib-unlink-missing-ok
branch
from
April 9, 2018 08:54
6d6f2e9 to
68d5edb
Compare
Fixes bpo-33123
rbu
force-pushed
the
pathlib-unlink-missing-ok
branch
from
April 9, 2018 14:59
68d5edb to
4277aab
Compare
pitrou
approved these changes
May 15, 2019
pitrou
left a comment
Member
There was a problem hiding this comment.
A simple enough addition. LGTM.
Contributor
|
@rbu: Status check is done, and it's a success ✅ . |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Similarly to how several pathlib file creation functions have an "exists_ok" parameter, we should introduce "missing_ok" that makes removal functions not raise an exception when a file or directory is already absent. IMHO, this should cover Path.unlink and Path.rmdir. Note, Path.resolve() has a "strict" parameter since 3.6 that does the same thing. Naming this of this new parameter tries to be consistent with the "exists_ok" parameter as that is more explicit about what it does (as opposed to "strict").
https://bugs.python.org/issue33123