GNOME Bugzilla – Bug 756352
g_arg_info_get_closure broken for non callback args
Last modified: 2015-10-10 20:42:55 UTC
https://git.gnome.org/browse/gobject-introspection/commit/?id=0a134a608f5b471c3a12739785e149ceaf90df27 broke PyGObject, see bug 756109. It makes g_arg_info_get_closure() return the closure index of itself for user_data args but it should return -1 as it isn't a callback.
Created attachment 313026 [details] [review] 0001-maintransformer-Fix-regression-in-callback-closure-a.patch
Mh wait, the problem is that g_arg_info_get_closure("user_data") returns "user_data". This has always been the case for arguments marked with (closure). With your change g_arg_info_get_closure("user_data") returns "callback", which seems more broken to me. I need to check what gjs does...
Review of attachment 313026 [details] [review]: eh, I don't think it should be called "closure_name" then.
(PyGObject tests pass again with the above patch)
Oh ok, I found the problem: before the patch, the g_arg_info_get_closure(i) == i case was only for callbacks, not for functions. Comment in the g-i code: # For callbacks, (closure) appears without an # argument, and tags a parameter that is a closure. We # represent it (weirdly) in the gir and typelib by # setting param.closure_name to itself. I think the right fix (ie, to restore previous behavior) is to remove the line setting param.closure_name = param.argname
Created attachment 313027 [details] [review] 0001-maintransformer-Fix-regression-in-callback-closure-a.patch
Yes, but just deleting that would break the nullable logic. This patch should fix both hopefully.
Review of attachment 313027 [details] [review]: It took me a moment for me to be convinced, but this patch is right. Please discard the pygobject patch, which is wrong now.
https://git.gnome.org/browse/gobject-introspection/commit/?id=0aa60a43c4c9679668e15dbf3ef7a39016525150