diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | gobject/pygenum.c | 7 |
2 files changed, 10 insertions, 2 deletions
@@ -1,3 +1,8 @@ +2008-03-24 Paul Pogonyshev <pogonyshev@gmx.net> + + * gobject/pygenum.c (pyg_enum_richcompare): Don't return NULL + after warning; more useful warning message (bug #519631). + 2008-03-22 Johan Dahlin <johan@gnome.org> * gio/ginputstream.override: diff --git a/gobject/pygenum.c b/gobject/pygenum.c index 543bc49..876e464 100644 --- a/gobject/pygenum.c +++ b/gobject/pygenum.c @@ -30,14 +30,17 @@ static PyObject * pyg_enum_richcompare(PyGEnum *self, PyObject *other, int op) { + static char warning[256]; + if (!PyInt_Check(other)) { Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } if (PyObject_TypeCheck(other, &PyGEnum_Type) && ((PyGEnum*)other)->gtype != self->gtype) { - PyErr_Warn(PyExc_Warning, "comparing different enum types"); - return NULL; + g_snprintf(warning, sizeof(warning), "comparing different enum types: %s and %s", + g_type_name(self->gtype), g_type_name(((PyGEnum*)other)->gtype)); + PyErr_Warn(PyExc_Warning, warning); } return pyg_integer_richcompare((PyObject *)self, other, op); |