python: allow callback function to be a class method
The callback functionality only worked for regular Python functions. With this patch it also allows the callback to be a class method (bounded or unbounded) as show in example below. class test_class(object): def my_callback(self, msg, arg): print('handling %s' % str(msg)) s = netlink.core.Socket() testobj = test_class() netlink.capi.py_nl_cb_set(cb, netlink.capi.NL_CB_VALID, netlink.capi.NL_CB_CUSTOM, test_class.my_callback, testobj) netlink.capi.py_nl_cb_err(cb, netlink.capi.NL_CB_CUSTOM, test_class.my_callback, s) Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
Please register or sign in to comment