[pygi] don't error out on methods with callbacks as return type
- From: John Palmieri <johnp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygi] don't error out on methods with callbacks as return type
- Date: Thu, 20 May 2010 16:03:57 +0000 (UTC)
commit e928ea9b1df9d87314ff8e93479530e26be9bd87
Author: John (J5) Palmieri <johnp redhat com>
Date: Fri May 14 14:57:27 2010 -0400
don't error out on methods with callbacks as return type
* Right now we just throw an error which means API's like
gtk_about_dialog_set_url_hook aren't able to be called,
* this allows us to call such APIs while printing a warning, in most cases
API such as this doesn't need to be used anymore and is a result of
early GTK development
gi/pygi-argument.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/gi/pygi-argument.c b/gi/pygi-argument.c
index 57547a0..930df31 100644
--- a/gi/pygi-argument.c
+++ b/gi/pygi-argument.c
@@ -1433,9 +1433,17 @@ _pygi_argument_to_object (GArgument *arg,
switch (info_type) {
case GI_INFO_TYPE_CALLBACK:
{
- PyErr_SetString(PyExc_NotImplementedError, "callback marshalling is not supported yet");
- /* TODO */
- break;
+ /* There is no way we can support a callback return
+ * as we are never sure if the callback was set from C
+ * or Python. API that return callbacks are broken
+ * so we print a warning and send back a None
+ */
+
+ g_warning("You are trying to use an API which returns a callback."
+ "Callback returns can not be supported. Returning None instead.");
+ object = Py_None;
+ Py_INCREF(object);
+ break;
}
case GI_INFO_TYPE_BOXED:
case GI_INFO_TYPE_STRUCT:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]