From ecc390279163f57bea6b25ba06e8958848904900 Mon Sep 17 00:00:00 2001 From: Paul Pogonyshev Date: Wed, 27 Aug 2008 21:42:07 +0000 Subject: Bug 549191 – Constructor of gtk.TreeView raises TypeError when model is MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2008-08-28 Paul Pogonyshev Bug 549191 – Constructor of gtk.TreeView raises TypeError when model is None * gobject/pygtype.c (pyg_value_from_pyobject): Handle None in G_TYPE_INTERFACE branch. svn path=/trunk/; revision=954 --- gobject/pygtype.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'gobject/pygtype.c') diff --git a/gobject/pygtype.c b/gobject/pygtype.c index 715ed39..b12133d 100644 --- a/gobject/pygtype.c +++ b/gobject/pygtype.c @@ -657,14 +657,18 @@ pyg_value_from_pyobject(GValue *value, PyObject *obj) case G_TYPE_INTERFACE: /* we only handle interface types that have a GObject prereq */ if (g_type_is_a(G_VALUE_TYPE(value), G_TYPE_OBJECT)) { - if (!PyObject_TypeCheck(obj, &PyGObject_Type)) { - return -1; - } - if (!G_TYPE_CHECK_INSTANCE_TYPE(pygobject_get(obj), - G_VALUE_TYPE(value))) { - return -1; + if (obj == Py_None) + g_value_set_object(value, NULL); + else { + if (!PyObject_TypeCheck(obj, &PyGObject_Type)) { + return -1; + } + if (!G_TYPE_CHECK_INSTANCE_TYPE(pygobject_get(obj), + G_VALUE_TYPE(value))) { + return -1; + } + g_value_set_object(value, pygobject_get(obj)); } - g_value_set_object(value, pygobject_get(obj)); } else { return -1; } -- cgit