summaryrefslogtreecommitdiff
path: root/gi/pygobject-object.c
diff options
context:
space:
mode:
authorChristoph Reiter <creiter@src.gnome.org>2017-03-26 19:34:00 +0200
committerChristoph Reiter <creiter@src.gnome.org>2017-04-01 10:22:26 +0200
commit052cea9e2b6e599e52435df3155d8de22500e0f4 (patch)
treec2d6db114ed5903cc4ab5a3700bd4961d4762f02 /gi/pygobject-object.c
parent271e94b4e4cc9a9619015ef76880346ad7962ac4 (diff)
downloadpygobject-052cea9e2b6e599e52435df3155d8de22500e0f4.tar.gz
pygobject_lookup_class: clear exceptions between calls and don't return with one set
https://bugzilla.gnome.org/show_bug.cgi?id=773394
Diffstat (limited to 'gi/pygobject-object.c')
-rw-r--r--gi/pygobject-object.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/gi/pygobject-object.c b/gi/pygobject-object.c
index 0166a604..1e51f38f 100644
--- a/gi/pygobject-object.c
+++ b/gi/pygobject-object.c
@@ -913,6 +913,8 @@ pygobject_find_slot_for(PyTypeObject *type, PyObject *bases, int slot_offset,
* or interface has been registered for the given GType, then a new
* type will be created.
*
+ * Does not set an exception when NULL is returned.
+ *
* Returns: The wrapper class for the GObject or NULL if the
* GType has no registered type and a new type couldn't be created
*/
@@ -928,11 +930,14 @@ pygobject_lookup_class(GType gtype)
if (py_type == NULL) {
py_type = g_type_get_qdata(gtype, pyginterface_type_key);
- if (py_type == NULL)
+ if (py_type == NULL) {
py_type = (PyTypeObject *)pygi_type_import_by_g_type(gtype);
+ PyErr_Clear ();
+ }
if (py_type == NULL) {
py_type = pygobject_new_with_interfaces(gtype);
+ PyErr_Clear ();
g_type_set_qdata(gtype, pyginterface_type_key, py_type);
}
}