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 vstinner
Recipients Aaron.Swan, Esa.Peuha, r.david.murray, vstinner
Date 2021-11-17.18:12:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1637172755.85.0.188440274827.issue21876@roundup.psfhosted.org>
In-reply-to
Content
It's nice if os.rename() can be atomic. It can be atomic if it is implemented as a single syscall and the source and the destination are on the same filesystem.

If we modify the implement to check if src and/or dst is a hardlink, we will need more syscalls which cannot be atomic. What if another process replaces src or dst before or after the rename() syscall?

I suggest to document the issue. Or maybe we need a new flavor which keeps the current behavior.

"Atomic write" is an old topic and no one managed to implement it in a portable way. So maybe you can ignore the atomicity constraint.
History
Date User Action Args
2021-11-17 18:12:35vstinnersetrecipients: + vstinner, r.david.murray, Esa.Peuha, Aaron.Swan
2021-11-17 18:12:35vstinnersetmessageid: <1637172755.85.0.188440274827.issue21876@roundup.psfhosted.org>
2021-11-17 18:12:35vstinnerlinkissue21876 messages
2021-11-17 18:12:35vstinnercreate