Skip to content

gh-158666: Avoid copy if shutil.move fails other than EXDEV - #158667

Open
ptim0626 wants to merge 10 commits into
python:mainfrom
ptim0626:shutil-move-no-left-over
Open

ptim0626 wants to merge 10 commits into
python:mainfrom
ptim0626:shutil-move-no-left-over

Conversation

@ptim0626

@ptim0626 ptim0626 commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

@ptim0626

ptim0626 commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

I am not entirely sure how Windows handles unwritable directory (or if there is such concept in Windows at all), as it seems the failed CI all related to directory not set to unwritable in Windows via chmod.

@ptim0626

Copy link
Copy Markdown
Contributor Author

After some thoughts I think the cleanest way to test is just to mock os.rename to return PermissionError (or other exceptions but not EXDEV), although it might be possible to use some commands in Windows with a subprocess to set file/directory as non-writable (os.chmod seems not working quite well with Windows), it may overcomplicate things and I am not familiar with those Windows commands...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant