@@ -147,7 +147,7 @@ def _resolve_ctk_root_via_canary() -> str | None:
147147 return ctk_root
148148
149149
150- def _resolve_in_trusted_dirs (normalized_name : str , dirs : list [Path ]) -> str | None :
150+ def _resolve_in_trusted_dirs (normalized_name : str , dirs : list [Path ]) -> Path | None :
151151 """Resolve ``normalized_name`` against ``dirs`` in order."""
152152 seen : set [Path ] = set ()
153153 for directory in dirs :
@@ -162,7 +162,7 @@ def _resolve_in_trusted_dirs(normalized_name: str, dirs: list[Path]) -> str | No
162162 # search dir would otherwise leak a relative result). os.path.abspath
163163 # has no pathlib equivalent: Path.absolute() does not normalize and
164164 # Path.resolve() would also follow symlinks.
165- return os .path .abspath (candidate )
165+ return Path ( os .path .abspath (candidate ) )
166166 return None
167167
168168
@@ -283,7 +283,8 @@ def find_nvidia_binary_utility(utility_name: str) -> str | None:
283283 candidate_names = (f"{ utility_name } .bat" , normalized_name )
284284 found = _resolve_names_in_trusted_dirs (candidate_names , dirs )
285285 else :
286- found = _resolve_in_trusted_dirs (normalized_name , dirs )
286+ resolved = _resolve_in_trusted_dirs (normalized_name , dirs )
287+ found = None if resolved is None else str (resolved )
287288 if found is not None :
288289 return found
289290
@@ -299,7 +300,8 @@ def find_nvidia_binary_utility(utility_name: str) -> str | None:
299300 if IS_WINDOWS and utility_name == "compute-sanitizer" :
300301 found = _find_windows_compute_sanitizer (cuda_path )
301302 else :
302- found = _resolve_in_trusted_dirs (normalized_name , _ctk_bin_subdirs (cuda_path ))
303+ resolved = _resolve_in_trusted_dirs (normalized_name , _ctk_bin_subdirs (cuda_path ))
304+ found = None if resolved is None else str (resolved )
303305 if found is not None :
304306 return found
305307
@@ -308,5 +310,6 @@ def find_nvidia_binary_utility(utility_name: str) -> str | None:
308310 if ctk_root is not None :
309311 if IS_WINDOWS and utility_name == "compute-sanitizer" :
310312 return _find_windows_compute_sanitizer (ctk_root )
311- return _resolve_in_trusted_dirs (normalized_name , _ctk_bin_subdirs (Path (ctk_root )))
313+ resolved = _resolve_in_trusted_dirs (normalized_name , _ctk_bin_subdirs (Path (ctk_root )))
314+ return None if resolved is None else str (resolved )
312315 return None
0 commit comments