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 773394 - Python import failures in _pygi_type_import_by_name are not properly propagated
Python import failures in _pygi_type_import_by_name are not properly propagated
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: general
Git master
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2016-10-23 18:48 UTC by Erika
Modified: 2017-04-01 08:26 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch including two error checks (1.06 KB, patch)
2016-10-23 18:48 UTC, Erika
none Details | Review
pygobject_lookup_class: clear exceptions between calls and don't return with one set (1.46 KB, patch)
2017-03-26 17:51 UTC, Christoph Reiter (lazka)
committed Details | Review

Description Erika 2016-10-23 18:48:43 UTC
Created attachment 338300 [details] [review]
Patch including two error checks

pygobject_lookup_class(1)
calls pygi_type_import_by_g_type(2)
calls pygobject_new_with_interfaces(3)
which calls PyObject_CallFunction(4)

If pygi_type_import_by_g_type(2) fails with a python error
and it is not handled then PyObject_CallFunction(4) will
crash at an assertion.

The included patch adds an error check between 2 and 3 and
another one in pygobject_new_full to distinguish between tp being NULL
because an internal inconsistency or because of a python error.
Comment 1 Christoph Reiter (lazka) 2017-03-26 17:51:32 UTC
Created attachment 348742 [details] [review]
pygobject_lookup_class: clear exceptions between calls and don't return with one set

Thanks.

I think it makes more sense here to just not raise an exception, as the NULL return value isn't handled anyway in the rest of the code base.