aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-04-26 09:14:42 +0200
committerMattias Andrée <maandree@operamail.com>2015-04-26 09:14:42 +0200
commit04d1407fe81bc474c74ce29da0b388fd33f6150b (patch)
treeba2cc09465d82090519e0cf12aedfa879e314e03 /src
parentfix bug (diff)
downloadpython-bus-04d1407fe81bc474c74ce29da0b388fd33f6150b.tar.gz
python-bus-04d1407fe81bc474c74ce29da0b388fd33f6150b.tar.bz2
python-bus-04d1407fe81bc474c74ce29da0b388fd33f6150b.tar.xz
update callback wrapper to support bus 2.02.0
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src')
-rw-r--r--src/native_bus.pyx8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/native_bus.pyx b/src/native_bus.pyx
index 5cc425c..de33e91 100644
--- a/src/native_bus.pyx
+++ b/src/native_bus.pyx
@@ -201,9 +201,13 @@ def bus_write_wrapped(bus : int, message : str) -> int:
cdef int bus_callback_wrapper(const char *message, user_data):
- cdef bytes bs = message
+ cdef bytes bs
callback, user_data = tuple(<object>user_data)
- return <int>callback(bs, user_data)
+ if message is NULL:
+ return <int>callback(None, user_data)
+ else:
+ bs = message
+ return <int>callback(bs, user_data)
def bus_read_wrapped(bus : int, callback : callable, user_data) -> int: