gh-119993 ignore `NotADirectoryError` in `Path.unlink()` if `missing_ok` is `True` by MusicalNinjaDad · Pull Request #120049 · python/cpython
MusicalNinjaDad
changed the title
gh-119993 Document when
gh-119993 ignore NotADirectoryError is raised by Path.unlink()NotADirectoryError in Path.unlink() if missing_ok is `True
MusicalNinjaDad
changed the title
gh-119993 ignore
gh-119993 ignore NotADirectoryError in Path.unlink() if missing_ok is `TrueNotADirectoryError in Path.unlink() if missing_ok is True
@barneygale - this is how unlink would/could work if it were to ignore NotADirectoryError. Semantically that makes success with missing_ok = True mean "The file is not there afterwards" and with missing_ok = False to mean "The file was deleted". I think this makes sense, but I have no strong feelings that it must be like this.
Windows works differently from Linux/MacOS and raises FileNotFoundError if an intermediate path refers to a file. Without this change the same end-user code will potentially raise on one OS and not on another for the same situation.
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.
Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.
And if you don't make the requested changes, you will be put in the comfy chair!
@barneygale - I was unexpectedly offline for the last 6 months due to illness.
I've just pushed the changes you requested and will now start to merge into the lasted main
Looking back through my code from the summer: Did I understand your request correctly to integrate the test into test_pathlib_abc.py? I ended up completely mocking the functionality in DummyPath making that test a no-op. The test is also still present in test_pathlib.py - so no value from inheritance if I understand correctly...
I see the ABC no longer includes unlink() as of #127736 - so leaving previous comments as resolved and taking over the new version of test_pathlib_abc.py
…119993 Keep origin/main version of test_pathlib_abc.py - need to reimplement changes from MusicalNinjaDad/issue119993 in context of significant changes to class structure
Thanks for making the requested changes!
@barneygale: please review the changes made to this pull request.
@barneygale - is there anything I can do to support with this? Should I rebase and reintegrate with all the work you've done on the ABCs?