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 eryksun
Recipients Aaron.Swan, Esa.Peuha, eryksun, r.david.murray, vstinner
Date 2021-11-17.20:34:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1637181255.24.0.167003702005.issue21876@roundup.psfhosted.org>
In-reply-to
Content
> It's nice if os.rename() can be atomic. 

How about fixing the behavior in shutil.move()? Currently it tries os.rename(src, dst) without checking for this case. For example:

    >>> os.path.samefile('src', 'dst')
    True
    >>> shutil.move('src', 'dst')
    'dst'
    >>> os.path.exists('src')
    True
    >>> os.stat('src').st_nlink
    2

---

Note that there's nothing to fix, and not much to document in Windows. It works as expected. A slight difference from the general case is that os.replace() is required only when replacing a different file, not a hard link for the same file.
History
Date User Action Args
2021-11-17 20:34:15eryksunsetrecipients: + eryksun, vstinner, r.david.murray, Esa.Peuha, Aaron.Swan
2021-11-17 20:34:15eryksunsetmessageid: <1637181255.24.0.167003702005.issue21876@roundup.psfhosted.org>
2021-11-17 20:34:15eryksunlinkissue21876 messages
2021-11-17 20:34:15eryksuncreate