Skip to content

Commit c6aaaa7

Browse files
committed
fix(core.utils): keep path-backed ObjectCode error message Windows-friendly
`{code!r}` doubles every backslash on Windows, so the error string holds `'C:\\Users\\...\\file'` while `str(src)` only has single backslashes. Naive `str(path) in str(exc)` checks (and the `test_filestream_cache_path_backed_object_code_missing_file_message` assertion) failed on win-64 as a result. Drop the `!r` so the path appears verbatim; the message still quotes it via the surrounding sentence punctuation.
1 parent 69f6438 commit c6aaaa7

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

  • cuda_core/cuda/core/utils/_program_cache

cuda_core/cuda/core/utils/_program_cache/_abc.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@ def _extract_bytes(value: object) -> bytes:
3030
try:
3131
return Path(code).read_bytes()
3232
except FileNotFoundError:
33+
# Avoid ``{code!r}``: on Windows it doubles every backslash in
34+
# the path, which breaks naive ``str(path) in str(exc)`` checks
35+
# callers (and tests) write against the raw filesystem string.
3336
raise FileNotFoundError(
34-
f"cannot store path-backed ObjectCode in cache: {code!r} no longer exists"
37+
f"cannot store path-backed ObjectCode in cache: {code} no longer exists"
3538
) from None
3639
return bytes(code)
3740
raise TypeError(f"cache values must be bytes-like or ObjectCode, got {type(value).__name__}")

0 commit comments

Comments
 (0)