Skip to content

Commit f3c9d0f

Browse files
committed
avoid adding potentially problematic __dict__ to every child class
1 parent fdf4edc commit f3c9d0f

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

cuda_core/cuda/core/experimental/_memory.pyx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ cdef class _cyMemoryResource:
7373

7474
class MemoryResourceAttributes(abc.ABC):
7575

76+
__slots__ = ()
77+
7678
@property
7779
@abc.abstractmethod
7880
def is_device_accessible(self) -> bool:
@@ -107,8 +109,6 @@ cdef class Buffer(_cyBuffer, MemoryResourceAttributes):
107109
108110
Support for data interchange mechanisms are provided by DLPack.
109111
"""
110-
cdef dict __dict__ # required if inheriting from both Cython/Python classes
111-
112112
def __cinit__(self):
113113
self._ptr = 0
114114
self._size = 0
@@ -369,8 +369,6 @@ cdef class MemoryResource(_cyMemoryResource, MemoryResourceAttributes, abc.ABC):
369369
hold a reference to self, the buffer properties are retrieved simply by looking up the underlying
370370
memory resource's respective property.)
371371
"""
372-
cdef dict __dict__ # required if inheriting from both Cython/Python classes
373-
374372
cdef void _deallocate(self, intptr_t ptr, size_t size, cyStream stream) noexcept:
375373
self.deallocate(ptr, size, stream)
376374

@@ -675,7 +673,6 @@ cdef class DeviceMemoryResource(MemoryResource):
675673
bint _is_mapped
676674
object _uuid
677675
IPCAllocationHandle _alloc_handle
678-
dict __dict__ # required if inheriting from both Cython/Python classes
679676
object __weakref__
680677

681678
def __cinit__(self):

0 commit comments

Comments
 (0)