Skip to content

Conversation

@rbu
Copy link
Contributor

@rbu rbu commented Mar 22, 2018

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

@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Unfortunately our records indicate you have not signed the CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

Thanks again to your contribution and we look forward to looking at it!

@rbu rbu force-pushed the pathlib-unlink-missing-ok branch from 2e2506a to 6d6f2e9 Compare March 22, 2018 18:14
@rbu
Copy link
Contributor Author

rbu commented Mar 22, 2018

CLA is signed and submitted.

@serhiy-storchaka serhiy-storchaka added type-feature A feature request or enhancement and removed CLA not signed labels Mar 27, 2018
amirouche
Copy link

@amirouche amirouche Apr 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. fileA actually exists, but I changed to fileAAA which seems to be used for a non-existing file in other tests.

@rbu rbu force-pushed the pathlib-unlink-missing-ok branch from 6d6f2e9 to 68d5edb Compare April 9, 2018 08:54
@rbu rbu force-pushed the pathlib-unlink-missing-ok branch from 68d5edb to 4277aab Compare April 9, 2018 14:59
@csabella csabella requested a review from pitrou May 14, 2019 19:11
pitrou
Copy link
Member

@pitrou pitrou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A simple enough addition. LGTM.

@miss-islington
Copy link
Contributor

@rbu: Status check is done, and it's a success ✅ .

@miss-islington miss-islington merged commit d9e006b into python:master May 15, 2019
@csabella
Copy link
Contributor

Thank you, @pitrou, for the review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type-feature A feature request or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant