mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2025-12-25 15:10:16 +01:00
* python/dbus_bindings.pyx: Memory management foo (global): remove hacky _user_data_references global list (GIL_safe_cunregister_function_handler): userdata now stuffed into tuples. Unref user_data (GIL_safe_cmessage_function_handler): userdata now stuffed into tuples (Connection::__del__): Remove and replace with __dealloc__ method (Connection::add_filter): Stuff user_data into a tuple. Use Py_INCREF to keep tuple from being deallocated instead of the global var hack (Connection::register_object_path): Stuff user_data into a tuple. Use Py_INCREF to keep tuple from being deallocated instead of the global var hack (Connection::register_fallback): Stuff user_data into a tuple. Use Py_INCREF to keep tuple from being deallocated instead of the global var hack (GIL_safe_pending_call_notification): Don't unref the message because it gets unreffed when going out of scope. Py_XDECREF the user_data (PendingCall::__del__): Remove and replace with __dealloc__ method (PendingCall::set_notify): ref the pending call because we will need it to stick around for when the notify callback gets called (Message::__del__): Remove and replace with __dealloc__ method * python/dbus_glib_bindings.pyx (init_gthreads): Changed to gthreads_init to match up with the dbus call * python/glib.py (init_threads): Changed to threads_init to match up with gobject.threads_init(). init_threads is kept for backwards compat but will most likely be deprecated in the future * test/python/test-client.py: - revamp to use Python's unittest functionality - add async call tests - setup threads in glib and dbus so we make sure locks are working
17 lines
454 B
Python
17 lines
454 B
Python
import dbus
|
|
import dbus_glib_bindings
|
|
|
|
def _setup_with_g_main(conn):
|
|
dbus_glib_bindings.setup_with_g_main(conn._connection)
|
|
|
|
_dbus_gthreads_initialized = False
|
|
def threads_init():
|
|
global _dbus_gthreads_initialized
|
|
if not _dbus_gthreads_initialized:
|
|
dbus_glib_bindings.gthreads_init()
|
|
_dbus_gthreads_initialized = True
|
|
|
|
def init_threads():
|
|
threads_init()
|
|
|
|
setattr(dbus, "_dbus_mainloop_setup_function", _setup_with_g_main)
|