pygobject r877 - in trunk: . gobject



Author: paulp
Date: Sat Jul 26 21:41:58 2008
New Revision: 877
URL: http://svn.gnome.org/viewvc/pygobject?rev=877&view=rev

Log:
2008-07-27  Paul Pogonyshev  <pogonyshev gmx net>

	* gobject/pygtype.c (pyg_enum_get_value): Issue warning if 'obj'
	is a PyGEnum of wrong type, i.e. not matching 'enum_type' (bug
	#503771).


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

Modified: trunk/gobject/pygtype.c
==============================================================================
--- trunk/gobject/pygtype.c	(original)
+++ trunk/gobject/pygtype.c	Sat Jul 26 21:41:58 2008
@@ -428,6 +428,12 @@
     } else if (PyInt_Check(obj)) {
 	*val = PyInt_AsLong(obj);
 	res = 0;
+
+	if (PyObject_TypeCheck(obj, &PyGEnum_Type) && ((PyGEnum *) obj)->gtype != enum_type) {
+	    g_warning("expected enumeration type %s, but got %s instead",
+		      g_type_name(enum_type),
+		      g_type_name(((PyGEnum *) obj)->gtype));
+	}
     } else if (PyString_Check(obj)) {
 	GEnumValue *info;
 	char *str = PyString_AsString(obj);



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