GNOME Bugzilla – Bug 684319
Introspected version of g_resources_(un)register needs a trailing underscore
Last modified: 2017-05-04 21:43:29 UTC
When using PyGObject, I can't call Gio.Resource.register and need to call Gio.Resource._register instead. Same goes for unregister.
Ok, this is a very nasty bug. Basically, for API like this: void regress_test_objstuffstuffstuff_other_prefix2 (RegressTestObj *obj); We end up with: <method name="tuffstuffstuff_other_prefix2" c:identifier="regress_test_objstuffstuffstuff_other_prefix2"> Because we simply strip off the "expected prefix" + 1, where the assumed the +1 would be the underscore. We probably should have made this a fatal error...but far too late now, this bit of code has been around a long time =( Option #1: Check whether there's an underscore where we expect. If not, we can generate *two* versions of the method. One which is a legacy backwards compat version, and one where we just ignore the intervening junk. Option #2 is to warn, and not do anything in g-i. Then libraries would have to be fixed. For GLib, this would mean we'd need new symbols g_resource_register()/g_resource_unregister(). I'm not sure which is better. I think we should add a warning regardless.
Created attachment 227371 [details] [review] scanner: Warn for methods which don't have the expected prefix For API that "looks like" a method, previously, we simply stripped off the "expected prefix". The problem comes for things like void g_resources_register (GResource *resource); We expect this to be void g_resource_register (GResource *resource); At present, the "s" gets stripped, and the _ gets into the name. This is obviously very suboptimal. However, there's a large backwards compatibility concern here - we can't just rename the methods at this point. The behavior has existed for a long time. Thus for now, simply warn. Unfortunately we can't add a test to tests/warn because it doesn't support custom objects.
Created attachment 227381 [details] [review] scanner: Add "Alias" tag for fixing method names This allows users to fix method names that are parsed badly.
Created attachment 227382 [details] [review] GResources: Make use of Alias tag for g_resources_register/unregister Due to historical bogosity in g-ir-scanner, these method names end up as "_register" and "_unregister", i.e. with a leading underscore. This is lame, but we need to keep them. Use a new g-i feature to also expose them with a different name.
Does gtk-doc know to ignore these new tags ?
(In reply to comment #5) > Does gtk-doc know to ignore these new tags ? Probably not...this is https://bugzilla.gnome.org/show_bug.cgi?id=676133
I'd prefer if we introduced g_resource_register / g_resource_unregister and deprecated the old symbols.
Review of attachment 227371 [details] [review]: Looks good
Review of attachment 227381 [details] [review]: Going to need a rebase.
Review of attachment 227382 [details] [review]: Going to need a rebase.
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]
Review of attachment 227371 [details] [review]: Is this patch still relevant as https://git.gnome.org/browse/gobject-introspection/commit/?id=6432c9213bff425d7d0f2be39df59337588caff3 seems to have introduced a different solution?
Review of attachment 227382 [details] [review]: Is this patch still relevant as https://git.gnome.org/browse/gobject-introspection/commit/?id=6432c9213bff425d7d0f2be39df59337588caff3 seems to have introduced a different solution?
Two years later and no comment → obsolete.