@@ -8,7 +8,7 @@ cimport pyverbs.libibverbs as v
cdef class Context(PyverbsObject):
cdef v.ibv_context *context
cdef object name
- cdef _close(self)
+ cpdef close(self)
cdef class DeviceAttr(PyverbsObject):
cdef v.ibv_device_attr dev_attr
@@ -102,16 +102,9 @@ cdef class Context(PyverbsObject):
Closes the inner IB device.
:return: None
"""
- self._close()
+ self.close()
- def close(self):
- """
- Closes the inner IB device.
- :return: None
- """
- self._close()
-
- cdef _close(self):
+ cpdef close(self):
self.logger.debug('Closing Context')
if self.context != NULL:
rc = v.ibv_close_device(self.context)
Instead of a declaring both cdef and def function, use a single cpdef close(). The main drawback of such an apporoach is a potential performance degradation, but it will be visible only during objects teardown, which don't have performance constraints anyway. Signed-off-by: Noa Osherovich <noaos@mellanox.com> --- pyverbs/device.pxd | 2 +- pyverbs/device.pyx | 11 ++--------- 2 files changed, 3 insertions(+), 10 deletions(-)