Skip to content

Commit 4096885

Browse files
committed
Move _handle_uint last in LoadedDL, to emphasize that this is private member.
1 parent 428a2dc commit 4096885

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

cuda_pathfinder/cuda/pathfinder/_dynamic_libs/load_dl_common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ class DynamicLibNotFound(RuntimeError):
1313

1414
@dataclass
1515
class LoadedDL:
16-
_handle_uint: int # Platform-agnostic unsigned pointer value
1716
abs_path: Optional[str]
1817
was_already_loaded_from_elsewhere: bool
18+
_handle_uint: int # Platform-agnostic unsigned pointer value
1919

2020

2121
def load_dependencies(libname: str, load_func: Callable[[str], LoadedDL]) -> None:

cuda_pathfinder/cuda/pathfinder/_dynamic_libs/load_dl_linux.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def check_if_already_loaded_from_elsewhere(libname: str) -> Optional[LoadedDL]:
7878
except OSError:
7979
continue
8080
else:
81-
return LoadedDL(handle._handle, abs_path_for_dynamic_library(libname, handle), True)
81+
return LoadedDL(abs_path_for_dynamic_library(libname, handle), True, handle._handle)
8282
return None
8383

8484

@@ -100,7 +100,7 @@ def load_with_system_search(libname: str, soname: str) -> Optional[LoadedDL]:
100100
abs_path = abs_path_for_dynamic_library(libname, handle)
101101
if abs_path is None:
102102
raise RuntimeError(f"No expected symbol for {libname=!r}")
103-
return LoadedDL(handle._handle, abs_path, False)
103+
return LoadedDL(abs_path, False, handle._handle)
104104
except OSError:
105105
return None
106106

@@ -122,4 +122,4 @@ def load_with_abs_path(libname: str, found_path: str) -> LoadedDL:
122122
handle = ctypes.CDLL(found_path, CDLL_MODE)
123123
except OSError as e:
124124
raise RuntimeError(f"Failed to dlopen {found_path}: {e}") from e
125-
return LoadedDL(handle._handle, found_path, False)
125+
return LoadedDL(found_path, False, handle._handle)

cuda_pathfinder/cuda/pathfinder/_dynamic_libs/load_dl_windows.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def check_if_already_loaded_from_elsewhere(libname: str) -> Optional[LoadedDL]:
7777
continue
7878
else:
7979
return LoadedDL(
80-
pywintypes_handle_to_unsigned_int(handle), abs_path_for_dynamic_library(libname, handle), True
80+
abs_path_for_dynamic_library(libname, handle), True, pywintypes_handle_to_unsigned_int(handle)
8181
)
8282
return None
8383

@@ -101,7 +101,7 @@ def load_with_system_search(libname: str, soname: str) -> Optional[LoadedDL]:
101101
continue
102102
else:
103103
return LoadedDL(
104-
pywintypes_handle_to_unsigned_int(handle), abs_path_for_dynamic_library(libname, handle), False
104+
abs_path_for_dynamic_library(libname, handle), False, pywintypes_handle_to_unsigned_int(handle)
105105
)
106106

107107
return None
@@ -132,4 +132,4 @@ def load_with_abs_path(libname: str, found_path: str) -> LoadedDL:
132132
handle = win32api.LoadLibraryEx(found_path, 0, flags)
133133
except pywintypes.error as e:
134134
raise RuntimeError(f"Failed to load DLL at {found_path}: {e}") from e
135-
return LoadedDL(pywintypes_handle_to_unsigned_int(handle), found_path, False)
135+
return LoadedDL(found_path, False, pywintypes_handle_to_unsigned_int(handle))

0 commit comments

Comments
 (0)