From: Arend van Spriel Date: Thu, 5 Sep 2013 12:11:31 +0000 (+0200) Subject: use Callback object constructing Socket X-Git-Tag: libnl3_2_23rc1~17 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2d55872fb1f735565fa0e34dbe7889dd31f09f00;p=libnl use Callback object constructing Socket Signed-off-by: Arend van Spriel Signed-off-by: Thomas Graf --- diff --git a/python/netlink/core.py b/python/netlink/core.py index f43fd2c..89773f6 100644 --- a/python/netlink/core.py +++ b/python/netlink/core.py @@ -184,10 +184,12 @@ class Socket(object): """Netlink socket""" def __init__(self, cb=None): - if cb is None: + if isinstance(cb, Callback): + self._sock = capi.nl_socket_alloc_cb(cb._cb) + elif cb == None: self._sock = capi.nl_socket_alloc() else: - self._sock = capi.nl_socket_alloc_cb(cb) + raise Exception('\'cb\' parameter has wrong type') if self._sock is None: raise Exception('NULL pointer returned while allocating socket')