[patch] [python] Some small fixes from Phil Thompson

Simon McVittie simon.mcvittie at collabora.co.uk
Wed Jan 17 05:17:10 PST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

As usual, pullable from
http://people.freedesktop.org/~smcv/git/dbus-python/.git

- From cc4dfc18c7fe0843b5e118d35a94ca9cca563f98 Mon Sep 17 00:00:00 2001
From: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date: Wed, 17 Jan 2007 12:27:51 +0000
Subject: [PATCH] DBusGMainLoop: avoid reference leak on success
(thanks Phil Thompson, <phil riverbankcomputing co uk>)
- ---
 _dbus_glib_bindings/module.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/_dbus_glib_bindings/module.c b/_dbus_glib_bindings/module.c
index ddd0ef2..95a2c99 100644
- --- a/_dbus_glib_bindings/module.c
+++ b/_dbus_glib_bindings/module.c
@@ -127,6 +127,7 @@ DBusGMainLoop (PyObject *always_null UNUSED, PyObject *args, PyObject *kwargs)
             Py_DECREF(mainloop);
             return NULL;
         }
+        Py_DECREF(result);
     }
     return mainloop;
 }

- From 4dbee87fbe9dd7abb56d8d150d8c8ae7bd01f261 Mon Sep 17 00:00:00 2001
From: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date: Wed, 17 Jan 2007 12:28:38 +0000
Subject: [PATCH] dbus/service.py: cope with exceptions with no __module__
(thanks Phil Thompson, <phil riverbankcomputing co uk>)
- ---
 dbus/service.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dbus/service.py b/dbus/service.py
index 1cb63f3..da64a1e 100644
- --- a/dbus/service.py
+++ b/dbus/service.py
@@ -248,9 +248,9 @@ def _method_reply_return(connection, message, method_name, signature, *retval):
 
 
 def _method_reply_error(connection, message, exception):
- -    if '_dbus_error_name' in exception.__dict__:
+    if hasattr(exception, '_dbus_error_name'):
         name = exception._dbus_error_name
- -    elif exception.__module__ == '__main__':
+    elif getattr(exception, '__module__', '') in ('', '__main__'):
         name = 'org.freedesktop.DBus.Python.%s' % exception.__class__.__name__
     else:
         name = 'org.freedesktop.DBus.Python.%s.%s' % (exception.__module__, exception.__class__.__name__)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: OpenPGP key: http://www.pseudorandom.co.uk/2003/contact/ or pgp.net

iD8DBQFFriHWWSc8zVUw7HYRAsg8AJwJhW6WIIbqxpRH2xk1cIZfhYtydwCfQ25K
82zLDpxcW1H4QYu/4hlJPSQ=
=Xpd6
-----END PGP SIGNATURE-----


More information about the dbus mailing list