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 632185 - repository.get_infos should list all implemented infos.
repository.get_infos should list all implemented infos.
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: introspection
unspecified
Other All
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2010-10-15 01:48 UTC by José Aliste
Modified: 2010-11-04 21:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
repository.get_infos should list all implmented infos. (1.06 KB, patch)
2010-10-15 01:48 UTC, José Aliste
needs-work Details | Review
implement missing info bindings (6.85 KB, patch)
2010-10-15 18:15 UTC, José Aliste
committed Details | Review

Description José Aliste 2010-10-15 01:48:05 UTC
Make repository.get_infos to return all the pygi-implemented
infos given a Namespace instead of failing when one of the infos
in the NameSpace is not implemented by pygi.
Comment 1 José Aliste 2010-10-15 01:48:08 UTC
Created attachment 172400 [details] [review]
repository.get_infos should list all implmented infos.
Comment 2 Tomeu Vizoso 2010-10-15 07:13:56 UTC
Review of attachment 172400 [details] [review]:

Is there any good reason for not having a test case for this?

Also, please remove all tabs and use spaces instead.

::: gi/pygi-repository.c
@@ +179,2 @@
         if (py_info == NULL) {
+	    PyErr_Clear ();

But this is going to clear as well other errors.

Some alternatives:

- Only call _pygi_info_new for infos that are implemented.

- Change _pygi_info_new to not raise a Python exception when there is no wrapper implemented, and just return NULL.

- Make sure we implement all wrappers.
Comment 3 José Aliste 2010-10-15 18:15:11 UTC
Created attachment 172445 [details] [review]
implement missing info bindings

The following patch takes the alternative of implementing all the previously not-implementing bindings. 

Should I still add a test?
Comment 4 johnp 2010-10-21 17:36:31 UTC
Yes please include a test
Comment 5 johnp 2010-10-28 15:50:50 UTC
I'm going to commit this for the release.  Jose, when you get a chance can you write a test just for insurance.  I don't think this will break anything but it would be nice to know perhaps if we miss coverage somewhere.
Comment 6 johnp 2010-10-28 17:55:00 UTC
For some reason with this patch applied I am getting:

NotImplementedError: <gi.UnionInfo object (Event) at 0x0x108f650>
Comment 7 johnp 2010-10-28 18:10:40 UTC
Ah, so I think you might be registering some of the types wrong.  If we hit an attr that is registered as PyGIBaseInfo_Type we will throw a NotImplemented error in module.py.  Any Info which can be an attr of the module must be an instance of PyGIRegisteredTypeInfo_Type.

Any reason UnionInfo was redefined to be registered to PyGIBaseInfo_Type?  I'm going to commit this to see if anyone reports an issue.  A quick look seems to imply that the other infos will never be a member of a module but we should consider that they may need to inherit from one of the other types.
Comment 8 johnp 2010-10-28 18:14:03 UTC
Comment on attachment 172445 [details] [review]
implement missing info bindings

Committed with fix for UnionInfo.  Please make sure PyGIBaseInfo_Type is the correct base type for the added infos.  If not please submit a patch to fix this.
Comment 9 johnp 2010-11-04 21:55:34 UTC
getting this out of the queue.