This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author giampaolo.rodola
Recipients ammar2, chris.jerdonek, giampaolo.rodola
Date 2019-02-12.22:32:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1550010746.18.0.354844418934.issue35951@roundup.psfhosted.org>
In-reply-to
Content
The proposed change makes the problem a lot less likely to occur, but technically it doesn't fix it because if the src file/dir disappears between "os.path.exists(src)" and os.rename(src, dst)" calls you'll end up with a race condition. We may still want to do it, but can't make promises about full reliability.

Also, it seems to me this behavior should be expected, because the doc explains the whole thing basically happens as a 3-step process (create dst dirs, rename, remove old src path). As such the cleanup in case of failure should not be expected, nor is promised. Also, FileNotFoundError is just one. os.rename() may fail for other reasons (and still leave the dst directory tree behind). If there is something we can do here is probably make the doc more clear (it talks about "lack of permissions" when instead it should have talked on "any error".

Extra (unrelated): as I commented on the PR, there are no unit-tests for os.renames().
History
Date User Action Args
2019-02-12 22:32:26giampaolo.rodolasetrecipients: + giampaolo.rodola, chris.jerdonek, ammar2
2019-02-12 22:32:26giampaolo.rodolasetmessageid: <1550010746.18.0.354844418934.issue35951@roundup.psfhosted.org>
2019-02-12 22:32:26giampaolo.rodolalinkissue35951 messages
2019-02-12 22:32:26giampaolo.rodolacreate