Skip to content

Commit 812ce0f

Browse files
committed
fixup! test(core.utils): suppress PermissionError on reader's corrupt-write (Windows sharing race)
1 parent 9b6da1b commit 812ce0f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

cuda_core/tests/test_program_cache_multiprocess.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,10 @@ def _worker_race_corrupt_reader(root: str, key: bytes, rounds: int, start_event,
159159
path = cache._path_for_key(key)
160160
for _ in range(rounds):
161161
# Best-effort corrupt write; ignore errors from the writer
162-
# having the file replaced mid-write.
163-
with contextlib.suppress(FileNotFoundError), open(path, "wb") as fh:
162+
# having the file replaced mid-write. On Windows the rewriter's
163+
# in-flight ``os.replace`` can also surface to the reader's open
164+
# as ``PermissionError`` (sharing violation / pending-delete).
165+
with contextlib.suppress(FileNotFoundError, PermissionError), open(path, "wb") as fh:
164166
fh.write(b"\x00not-a-pickle")
165167
with contextlib.suppress(KeyError):
166168
cache[key]

0 commit comments

Comments
 (0)