Use os.replace() instead of os.rename() for cache file moves on Windows#1252
Conversation
On Windows, os.rename() raises FileExistsError when the destination exists, unlike Unix where it atomically replaces. In _compile(), the file-by-file fallback path (entered when safe_rename cannot atomically move the build directory) silently caught this error, leaving stale binaries in place when strip_hash=True triggered an intentional overwrite. os.replace() is the cross-platform equivalent recommended by the Python docs for atomic destination replacement. Signed-off-by: Eric Shi <ershi@nvidia.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe pull request replaces Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR fixes a Windows-specific bug where
Confidence Score: 5/5
Important Files Changed
Last reviewed commit: 0757307 |
Summary
_compile()file-by-file fallback to useos.replace()instead ofos.rename(), which raisesFileExistsErroron Windows when the destination existsstrip_hash=Truetriggered an intentional overwrite, breaking thetest_aot_cache_skiptest on Windows GitHub runnersTest plan
test_aot_cache_skippasses locally (CPU + CUDA)test_aot_cache_skippasses on Windows GitHub runnersSummary by CodeRabbit