pygobject r954 - in trunk: . gobject



Author: paulp
Date: Wed Aug 27 21:42:07 2008
New Revision: 954
URL: http://svn.gnome.org/viewvc/pygobject?rev=954&view=rev

Log:
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.


Modified:
   trunk/ChangeLog
   trunk/gobject/pygtype.c

Modified: trunk/gobject/pygtype.c
==============================================================================
--- trunk/gobject/pygtype.c	(original)
+++ trunk/gobject/pygtype.c	Wed Aug 27 21:42:07 2008
@@ -657,14 +657,18 @@
     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;
 	}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]