diff options
author | Paul Pogonyshev <pogonyshev@gmx.net> | 2008-08-27 21:42:07 +0000 |
---|---|---|
committer | Paul Pogonyshev <paulp@src.gnome.org> | 2008-08-27 21:42:07 +0000 |
commit | ecc390279163f57bea6b25ba06e8958848904900 (patch) | |
tree | a406e5d7328f1a91fd211424ef085b3cc344f8a9 /gobject/pygtype.c | |
parent | af2ba2b7bf6388b46f98706991430b827737e0d0 (diff) | |
download | pygobject-ecc390279163f57bea6b25ba06e8958848904900.tar.gz pygobject-ecc390279163f57bea6b25ba06e8958848904900.tar.xz pygobject-ecc390279163f57bea6b25ba06e8958848904900.zip |
Bug 549191 – Constructor of gtk.TreeView raises TypeError when model is
2008-08-28 Paul Pogonyshev <pogonyshev@gmx.net>
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
Diffstat (limited to 'gobject/pygtype.c')
-rw-r--r-- | gobject/pygtype.c | 18 |
1 files changed, 11 insertions, 7 deletions
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; } |