After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 692633 - Marshaling of non-local types does not import overrides
Marshaling of non-local types does not import overrides
Status: RESOLVED WONTFIX
Product: pygobject
Classification: Bindings
Component: introspection
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2013-01-27 12:09 UTC by Simon Feltman
Modified: 2013-01-29 06:44 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Simon Feltman 2013-01-27 12:09:53 UTC
This was found digging into bug 691185. 

When a method or property is accessed which returns a type that has not already been imported through gi.repository, overrides will never be imported for that type. This can be observed using Gst.ElementFactor.make without first importing the typelib for the type being returned (GstApp.AppSrc):

>>> from gi.repository import Gst
>>> Gst.init(None)
>>> src = Gst.ElementFactory.make('appsrc', None)
>>> type(src)
gi.types.__main__.GstAppSrc

vs:

>>> from gi.repository import GstApp
>>> from gi.repository import Gst
>>> Gst.init(None)
>>> src = Gst.ElementFactory.make('appsrc', None)
>>> type(src)
gi.repository.GstApp.AppSrc

In the former case, if AppSrc has overrides, they will not be loaded. This is also happening with properties of type Enum:

>>> from gi.repository import Gst
>>> Gst.init(None)
>>> src = Gst.ElementFactory.make('appsrc', None)
>>> src.props.stream_type
<enum GST_APP_STREAM_TYPE_STREAM of type GstAppStreamType>
>>> from gi.repository import GstApp
>>> src.props.stream_type = GstApp.AppStreamType.SEEKABLE
AttributeError: type object 'GstAppStreamType' has no attribute 'SEEKABLE'

The above messes up the GstApp.AppStreamType enum and it will not contain any values. However, importing GstApp before the property access will work.
Comment 1 Simon Feltman 2013-01-29 06:44:11 UTC
This seems like an impossible thing to fix without GType having the ability to provide a namespace that matches the gi namespace. From the perspective of pygobject, we are getting back a GObject instance which I do not see a way to get back the namespace "GstApp". We could attempt to do something hacky like parse the type name breaking it up on capital letters and then attempt to import each variation. But that doesn't sound very reasonable.