homepage

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 paul.moore, steve.dower, tim.golden, vinay.sajip, vstinner, zach.ware
Date 2021年04月28日.11:24:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1619609058.46.0.932540744329.issue43961@roundup.psfhosted.org>
In-reply-to
Content
I wrote PR 25684 to fix this issue.
> What does os.rename do on Linux? Does it just overwrite existing files by default?
os.rename() calls rename():
https://man7.org/linux/man-pages/man2/rename.2.html
 rename() renames a file, moving it between directories if
 required. Any other hard links to the file (as created using
 link(2)) are unaffected. Open file descriptors for oldpath are
 also unaffected.
 If newpath already exists, it will be atomically replaced, so
 that there is no point at which another process attempting to
 access newpath will find it missing. However, there will
 probably be a window in which both oldpath and newpath refer to
 the file being renamed.
On Windows, os.rename() is implemented with MoveFileExW(src, dst, 0).
Maybe the test should use os.replace() instead of os.rename()? On Windows, os.replace() is implemented with with MoveFileExW(src, dst, MOVEFILE_REPLACE_EXISTING).
HandlerWithNamerAndRotator.rotator() of test_logging calls os.rename() when the file already exists:
if os.path.exists(source):
 os.rename(source, dest + ".rotated")
And the test fails with "Cannot create a file when that file already exists"... well yes, we just tested that it exists.
History
Date User Action Args
2021年04月28日 11:24:18vstinnersetrecipients: + vstinner, paul.moore, vinay.sajip, tim.golden, zach.ware, steve.dower
2021年04月28日 11:24:18vstinnersetmessageid: <1619609058.46.0.932540744329.issue43961@roundup.psfhosted.org>
2021年04月28日 11:24:18vstinnerlinkissue43961 messages
2021年04月28日 11:24:17vstinnercreate

AltStyle によって変換されたページ (->オリジナル) /