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 6
6
7
7
import abc
8
8
import weakref
9
- from typing import Optional , Tuple , TypeVar
9
+ from typing import Optional , Tuple , TypeVar , Union
10
10
11
11
from cuda .core .experimental ._dlpack import DLDeviceType , make_py_capsule
12
12
from cuda .core .experimental ._stream import default_stream
18
18
# TODO: define a memory property mixin class and make Buffer and
19
19
# MemoryResource both inherit from it
20
20
21
+ DevicePointerT = Union [driver .CUdeviceptr , int , None ]
22
+ """A type union of `Cudeviceptr`, `int` and `None` for hinting Buffer.handle."""
23
+
21
24
22
25
class Buffer :
23
26
"""Represent a handle to allocated memory.
@@ -81,7 +84,7 @@ def close(self, stream=None):
81
84
self ._mnff .close (stream )
82
85
83
86
@property
84
- def handle (self ) -> driver . CUdeviceptr :
87
+ def handle (self ) -> DevicePointerT :
85
88
"""Return the buffer handle object.
86
89
87
90
.. caution::
You can’t perform that action at this time.
0 commit comments