Skip to content

File cache: use os.replace (clarity) and accept PermissionError#9483

Merged
leofang merged 1 commit into
cupy:mainfrom
seberg:harden-compile-file-move
Nov 14, 2025
Merged

File cache: use os.replace (clarity) and accept PermissionError#9483
leofang merged 1 commit into
cupy:mainfrom
seberg:harden-compile-file-move

Conversation

@seberg
Copy link
Copy Markdown
Member

@seberg seberg commented Nov 13, 2025

This uses os.replace() since it is a bit more clear that a within-folder move should be atomic.
It also allows PermissionError on windows since it is possible that the file was already created by another thread and opened for use and windows will then raise a PermissionError when the replace fails.

Unfortunately, I am not sure there is a good way to test this.

Closes gh-9463

This uses `os.replace()` since it is a bit more clear that a within-folder
move should be atomic.
It also allows `PermissionError` on windows since it is possible that the
file was already created by another thread and opened for use and windows
will then raise a `PermissionError` when the replace fails.

Unfortunately, I am not sure there is a good way to test this.

Closes cupygh-9463
@seberg seberg requested a review from a team as a code owner November 13, 2025 12:29
@leofang leofang added the cat:bug Bugs label Nov 13, 2025
@leofang
Copy link
Copy Markdown
Member

leofang commented Nov 13, 2025

/test mini

@leofang leofang merged commit e49ba44 into cupy:main Nov 14, 2025
49 checks passed
@leofang leofang self-assigned this Nov 14, 2025
@leofang leofang added this to the v14.0.0rc1 milestone Nov 14, 2025
@seberg seberg deleted the harden-compile-file-move branch November 14, 2025 06:43
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.

Multiprocessing _compile_with_cache_cuda race condition on Windows

2 participants