diff mbox series

[rdma-core,02/19] pyverbs: Unify close functions

Message ID 20190224130638.31848-3-noaos@mellanox.com (mailing list archive)
State Not Applicable
Headers show
Series Pyverbs additions | expand

Commit Message

Noa Osherovich Feb. 24, 2019, 1:06 p.m. UTC
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(-)
diff mbox series

Patch

diff --git a/pyverbs/device.pxd b/pyverbs/device.pxd
index 31d243a80dd5..7a6489da11bf 100644
--- a/pyverbs/device.pxd
+++ b/pyverbs/device.pxd
@@ -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
diff --git a/pyverbs/device.pyx b/pyverbs/device.pyx
index 3fad6af41ecc..cb3baed38afa 100644
--- a/pyverbs/device.pyx
+++ b/pyverbs/device.pyx
@@ -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)