Re: A few possible bugs



Hi Cole,

Comments below.

On Mon, Apr 15, 2013 at 10:02 AM, Cole Robinson <crobinso redhat com> wrote:
- Gdk.EventType has an attribute called 2BUTTON_PRESS, but that's an invalid
name in python. I noticed there's a _2BUTTON_PRESS, so maybe that was the
compromise.

This is an unfortunate side affect of splitting what is a valid C identifier up into namespace.identifier. Luckily this is the only occurrence I've seen so far, but it seems it also had the same name in PyGTK (gtk.gdk._2BUTTON_PRESS). There isn't much we can do about this beyond either logging a GTK+ bug which attempts to additionally add an alias which is nicer for GI or do so in the bindings, using an additional spelled out alias or something like that (DOUBLE_BUTTON_PRESS). The underscore in Python does make it feel like a private attribute.

- dir(GLib.IConv) lists a parameter named ''  (the empty string)

Funny, it looks like this is caused by the function named "g_iconv". GI is stripping iconv off to get rid of the class name on the method and there is nothing left. I would log this as a GLib bug which specifies the method should have a "Rename to:" annotation to something like "g_iconv_convert" or "g_iconv_iconv". The GI scanner should probably at least warn when this kind of thing happens because g_base_info_get_name is returning the empty string.

In [1]: from gi.repository import GLib
In [2]: iconv = getattr(GLib.IConv, '')
In [3]: iconv.__info__.get_name()
Out[3]: ''

- GObject.threads_init(), GLib.IO_IN, etc. don't show up in the dir() output.
They obviously work fine, but it's potentially confusing for the user.

Please log this as PyGObject bug.

- Gtk.Container.child_get_property() requires a GObject.Value() instance to be
passed in. Ideally it would work like GObject.get_property(), which just
returns the python converted value. Though changing this now would break
existing users, though it could be changed in a back compat way no doubt.

I definitely agree that this needs to be fixed, we can make it backwards compatible by accepting the GValue out arg as being optional, if not passed it just returns a marshaled value. There is already this ticket which I will update with the backwards compatible idea: https://bugzilla.gnome.org/show_bug.cgi?id=685076

-Simon



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]