@@ -77,7 +77,7 @@ def _resolve_ctk_root_via_canary() -> str | None:
7777 return ctk_root
7878
7979
80- def _resolve_in_trusted_dirs (normalized_name : str , dirs : list [Path ]) -> str | None :
80+ def _resolve_in_trusted_dirs (normalized_name : str , dirs : list [Path ]) -> Path | None :
8181 """Resolve ``normalized_name`` against ``dirs`` in order."""
8282 seen : set [Path ] = set ()
8383 for directory in dirs :
@@ -92,7 +92,7 @@ def _resolve_in_trusted_dirs(normalized_name: str, dirs: list[Path]) -> str | No
9292 # search dir would otherwise leak a relative result). os.path.abspath
9393 # has no pathlib equivalent: Path.absolute() does not normalize and
9494 # Path.resolve() would also follow symlinks.
95- return os .path .abspath (candidate )
95+ return Path ( os .path .abspath (candidate ) )
9696 return None
9797
9898
@@ -213,7 +213,8 @@ def find_nvidia_binary_utility(utility_name: str) -> str | None:
213213 candidate_names = (f"{ utility_name } .bat" , normalized_name )
214214 found = _resolve_names_in_trusted_dirs (candidate_names , dirs )
215215 else :
216- found = _resolve_in_trusted_dirs (normalized_name , dirs )
216+ resolved = _resolve_in_trusted_dirs (normalized_name , dirs )
217+ found = None if resolved is None else str (resolved )
217218 if found is not None :
218219 return found
219220
@@ -229,7 +230,8 @@ def find_nvidia_binary_utility(utility_name: str) -> str | None:
229230 if IS_WINDOWS and utility_name == "compute-sanitizer" :
230231 found = _find_windows_compute_sanitizer (cuda_path )
231232 else :
232- found = _resolve_in_trusted_dirs (normalized_name , _ctk_bin_subdirs (cuda_path ))
233+ resolved = _resolve_in_trusted_dirs (normalized_name , _ctk_bin_subdirs (Path (cuda_path )))
234+ found = None if resolved is None else str (resolved )
233235 if found is not None :
234236 return found
235237
@@ -238,5 +240,6 @@ def find_nvidia_binary_utility(utility_name: str) -> str | None:
238240 if ctk_root is not None :
239241 if IS_WINDOWS and utility_name == "compute-sanitizer" :
240242 return _find_windows_compute_sanitizer (ctk_root )
241- return _resolve_in_trusted_dirs (normalized_name , _ctk_bin_subdirs (Path (ctk_root )))
243+ resolved = _resolve_in_trusted_dirs (normalized_name , _ctk_bin_subdirs (Path (ctk_root )))
244+ return None if resolved is None else str (resolved )
242245 return None
0 commit comments