GNOME Bugzilla – Bug 618669
Handle callbacks as return types
Last modified: 2010-05-20 17:10:02 UTC
Right now we just throw an error when calling functions with a callback as a return type. Usually the callback is returned so an app can clean up after another callback has replaced it. I'm not sure if we need this functionality or if we can even be sure to always get back a closure containing a python callback but this does make functions that return callbacks usable. The correct patch might to be always return None. The current patch is meant to jumpstart discussion on the correct way to handle callback returns.
Created attachment 161092 [details] [review] [PATCH] support 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 * I'm not sure if this is the right patch - I'm thinking returning a callback is useless as we can't be 100% sure it is a Python callback wrapped in a closure. * Also as the patch stands we will be returning None anyway since the callback is destroyed before the return arg is processed * It might be best to just return None but for now I present this patch so we can figure out how we want to handle callback returns --- gi/pygi-argument.c | 23 +++++++++++++++++++++-- 1 files changed, 21 insertions(+), 2 deletions(-)
*** Bug 617804 has been marked as a duplicate of this bug. ***
Created attachment 161491 [details] [review] [PATCH] 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(-)
Decided the only sane thing to do is print an error and return None
I meant print a warning and return None
Review of attachment 161491 [details] [review]: Please replace tabs with spaces before pushing.
Committed with tab fixes