File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
cuda_core/cuda/core/experimental Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 66
77import abc
88import weakref
9- from typing import Optional , Tuple , TypeVar
9+ from typing import Optional , Tuple , TypeVar , Union
1010
1111from cuda .core .experimental ._dlpack import DLDeviceType , make_py_capsule
1212from cuda .core .experimental ._stream import default_stream
1818# TODO: define a memory property mixin class and make Buffer and
1919# MemoryResource both inherit from it
2020
21+ DevicePointerT = Union [driver .CUdeviceptr , int , None ]
22+ """A type union of `Cudeviceptr`, `int` and `None` for hinting Buffer.handle."""
23+
2124
2225class Buffer :
2326 """Represent a handle to allocated memory.
@@ -81,7 +84,7 @@ def close(self, stream=None):
8184 self ._mnff .close (stream )
8285
8386 @property
84- def handle (self ) -> driver . CUdeviceptr :
87+ def handle (self ) -> DevicePointerT :
8588 """Return the buffer handle object.
8689
8790 .. caution::
You can’t perform that action at this time.
0 commit comments