Author lordmauve
Recipients lordmauve, pitrou, rbu, serhiy.storchaka
Date 2018-07-17.14:07:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
This would be a shortcut in the common case that you simply want an idempotent "make sure this file/symlink is gone" operation.

There are already boolean options to enable idempotent behaviour in several pathlib implementations, such as mkdir(exist_ok=True) and touch(exist_ok=True). write_bytes() and write_text() are also idempotent. unlink() aligns well with this.

Because this operation doesn't exist, developers are tempted to write

    if path.exists():

which both has a TOCTTOU bug and doesn't correctly handle symlinks.
Date User Action Args
2018-07-17 14:07:41lordmauvesetrecipients: + lordmauve, pitrou, serhiy.storchaka, rbu
2018-07-17 14:07:41lordmauvesetmessageid: <>
2018-07-17 14:07:41lordmauvelinkissue33123 messages
2018-07-17 14:07:41lordmauvecreate