dbus/python dbus_bindings.pyx,1.4,1.5
John Palmieri
johnp at freedesktop.org
Wed Aug 31 01:21:06 EST 2005
Update of /cvs/dbus/dbus/python
In directory gabe:/tmp/cvs-serv7882/python
Modified Files:
dbus_bindings.pyx
Log Message:
* python/dbus_bindings.pyx (_pending_call_notification): Obtain the
GIL global lock when calling back into Python
Index: dbus_bindings.pyx
===================================================================
RCS file: /cvs/dbus/dbus/python/dbus_bindings.pyx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- dbus_bindings.pyx 26 Aug 2005 04:23:33 -0000 1.4
+++ dbus_bindings.pyx 30 Aug 2005 15:21:04 -0000 1.5
@@ -490,6 +490,7 @@
cdef void _pending_call_notification(DBusPendingCall *pending_call, void *user_data):
cdef DBusMessage *dbus_message
cdef Message message
+ cdef PyGILState_STATE gil
(reply_handler, error_handler) = <object>user_data
@@ -499,17 +500,21 @@
type = message.get_type()
- if type == MESSAGE_TYPE_METHOD_RETURN:
- args = message.get_args_list()
- reply_handler(*args)
- elif type == MESSAGE_TYPE_ERROR:
- args = message.get_args_list()
- if len(args) > 0:
- error_handler(DBusException(args[0]))
+ gil = PyGILState_Ensure()
+ try:
+ if type == MESSAGE_TYPE_METHOD_RETURN:
+ args = message.get_args_list()
+ reply_handler(*args)
+ elif type == MESSAGE_TYPE_ERROR:
+ args = message.get_args_list()
+ if len(args) > 0:
+ error_handler(DBusException(args[0]))
+ else:
+ error_handler(DBusException(""))
else:
- error_handler(DBusException(""))
- else:
- error_handler(DBusException('Unexpected Message Type: ' + message.type_to_name(type)))
+ error_handler(DBusException('Unexpected Message Type: ' + message.type_to_name(type)))
+ finally:
+ PyGILState_Release(gil)
dbus_message_unref(dbus_message)
dbus_pending_call_unref(pending_call)
More information about the dbus-commit
mailing list