summaryrefslogtreecommitdiffstats
path: root/python/netlink
diff options
context:
space:
mode:
authorArend van Spriel <arend@broadcom.com>2013-09-05 12:11:31 (GMT)
committerThomas Graf <tgraf@suug.ch>2013-09-05 15:46:00 (GMT)
commit2d55872fb1f735565fa0e34dbe7889dd31f09f00 (patch)
treec7946b286e23aab23cafb54c3434ae64fddfe50c /python/netlink
parent86207d47ab9966e6b8055718f51ae9c64d9f76ea (diff)
downloadlibnl-2d55872fb1f735565fa0e34dbe7889dd31f09f00.zip
libnl-2d55872fb1f735565fa0e34dbe7889dd31f09f00.tar.gz
libnl-2d55872fb1f735565fa0e34dbe7889dd31f09f00.tar.bz2
use Callback object constructing Socket
Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
Diffstat (limited to 'python/netlink')
-rw-r--r--python/netlink/core.py6
1 files changed, 4 insertions, 2 deletions
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')