Skip to content

Commit 6ba3e62

Browse files
authored
Merge pull request #622 from fozziethebeat/fix_permissionerror_order
Make sure bitsandbytes handles permission errors in the right order
2 parents e8a42e4 + b4bc336 commit 6ba3e62

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

bitsandbytes/cuda_setup/main.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,13 @@ def remove_non_existent_dirs(candidate_paths: Set[Path]) -> Set[Path]:
197197
try:
198198
if path.exists():
199199
existent_directories.add(path)
200+
except PermissionError as pex:
201+
# Handle the PermissionError first as it is a subtype of OSError
202+
# https://docs.python.org/3/library/exceptions.html#exception-hierarchy
203+
pass
200204
except OSError as exc:
201205
if exc.errno != errno.ENAMETOOLONG:
202206
raise exc
203-
except PermissionError as pex:
204-
pass
205207

206208
non_existent_directories: Set[Path] = candidate_paths - existent_directories
207209
if non_existent_directories:

0 commit comments

Comments
 (0)