[pygobject] Add deprecation warning for connect_object() with non-GObject argument
- From: Simon Feltman <sfeltman src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] Add deprecation warning for connect_object() with non-GObject argument
- Date: Tue, 12 Aug 2014 05:54:06 +0000 (UTC)
commit 86fb12b3e9b7558000d100f8f212e970ae8c4fd2
Author: Simon Feltman <sfeltman src gnome org>
Date: Mon Aug 11 22:47:14 2014 -0700
Add deprecation warning for connect_object() with non-GObject argument
GObject.connect_object() accepts any Python object and holds a strong
reference to it in the closure defeating the purpose of connect_object().
Add a warning so we can eventually limit connect_object() to GObject arguments
use the underlying g_signal_connect_object() which holds a weak reference.
https://bugzilla.gnome.org/show_bug.cgi?id=688064
gi/pygobject.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/gi/pygobject.c b/gi/pygobject.c
index 1a011e1..d006c33 100644
--- a/gi/pygobject.c
+++ b/gi/pygobject.c
@@ -1683,6 +1683,15 @@ connect_helper(PyGObject *self, gchar *name, PyObject *callback, PyObject *extra
return NULL;
}
+ if (object && !PyObject_TypeCheck (object, &PyGObject_Type)) {
+ if (PyErr_WarnEx (PyGIDeprecationWarning,
+ "Using non GObject arguments for connect_object() is deprecated, use: "
+ "connect_data(signal, callback, data, connect_flags=GObject.ConnectFlags.SWAPPED)",
+ 1)) {
+ return NULL;
+ }
+ }
+
g_signal_query (sigid, &query_info);
if (!pyg_gtype_is_custom (query_info.itype)) {
/* The signal is implemented by a non-Python class, probably
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]