Skip to content

Commit 6ed4a7f

Browse files
Fix typos and explicitly check types
1 parent 837e70c commit 6ed4a7f

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎cuda_core/cuda/core/_module.pyx‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ from __future__ import annotations
77
from libc.stddef cimport size_t
88

99
from collections import namedtuple
10-
from os import PathLike
10+
from os import fsencode, fspath, PathLike
1111

1212
from cuda.core._device import Device
1313
from cuda.core._launch_config cimport LaunchConfig
@@ -608,10 +608,10 @@ cdef class ObjectCode:
608608

609609
self._code_type = str(code_type)
610610

611-
if isinstance(module, CodeTypeT):
611+
if isinstance(module, (str, bytes, bytearray)):
612612
self._module = module
613613
elif isinstance(module, PathLike):
614-
self._module = os.fspath(module)
614+
self._module = fspath(module)
615615
else:
616616
self._module = module
617617
self._sym_map = {} if symbol_mapping is None else symbol_mapping
@@ -751,7 +751,7 @@ cdef class ObjectCode:
751751
elif isinstance(module, (bytes, bytearray)):
752752
self._h_library = create_library_handle_from_data(<const void*><char*>module)
753753
elif isinstance(module, PathLike):
754-
path_bytes = os.fsencode(module)
754+
path_bytes = fsencode(module)
755755
self._h_library = create_library_handle_from_file(<const char*>path_bytes)
756756
else:
757757
assert_type_str_or_bytes_like(module)

0 commit comments

Comments
 (0)