]> granicus.if.org Git - python/commit
bpo-33123: pathlib: Add missing_ok parameter to Path.unlink (GH-6191)
author‮zlohhcuB treboR <robert.buchholz@goodpoint.de>
Wed, 15 May 2019 22:02:11 +0000 (00:02 +0200)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 15 May 2019 22:02:11 +0000 (15:02 -0700)
commitd9e006bcefe6fac859b1b5d741725b9a91991044
tree47d9d85984d3767ae0a24e58b33e4a75e65e3372
parent1a2dd82f56bd813aacc570e172cefe55a8a41504
bpo-33123: pathlib: Add missing_ok parameter to Path.unlink (GH-6191)

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
Doc/library/pathlib.rst
Lib/pathlib.py
Lib/test/test_pathlib.py
Misc/NEWS.d/next/Library/2018-03-22-19-13-19.bpo-33123._Y5ooE.rst [new file with mode: 0644]