GNOME Bugzilla – Bug 773394
Python import failures in _pygi_type_import_by_name are not properly propagated
Last modified: 2017-04-01 08:26:30 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.
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.