Message406491
> 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. |
|
Date |
User |
Action |
Args |
2021-11-17 20:34:15 | eryksun | set | recipients:
+ eryksun, vstinner, r.david.murray, Esa.Peuha, Aaron.Swan |
2021-11-17 20:34:15 | eryksun | set | messageid: <1637181255.24.0.167003702005.issue21876@roundup.psfhosted.org> |
2021-11-17 20:34:15 | eryksun | link | issue21876 messages |
2021-11-17 20:34:15 | eryksun | create | |
|