cpython icon indicating copy to clipboard operation
cpython copied to clipboard

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

Open MusicalNinjaDad opened this issue 8 months ago • 1 comments

Add a short note on when Path.unlink() raises NotADirectoryError

This can occur "in the wild", for example, after calling shutil.move(src, dst) where dst is a non-existent directory. Debugging can cost a lot of time as the cause can be non-intuitive, potentially not nearby in the code and the docs don't mention the exception as being raised in any circumstances. (This just happened to me after encountering pypa/cibuildwheel#1850)

Fixes: #119993

  • Issue: gh-119993

📚 Documentation preview 📚: https://cpython-previews--120049.org.readthedocs.build/

MusicalNinjaDad avatar Jun 04 '24 15:06 MusicalNinjaDad