summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--gobject/pygenum.c3
-rw-r--r--gobject/pygflags.c8
3 files changed, 18 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 7007a12..2d259e3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2008-04-27 Paul Pogonyshev <pogonyshev@gmx.net>
+
+ * gobject/pygenum.c (pyg_enum_richcompare): Fix: raise warning as
+ exception if asked by PyErr_Warn().
+
+ * gobject/pygflags.c (pyg_flags_richcompare): Don't return NULL
+ after warning; more useful warning message.
+
+ (#480424, borrowing code by Mark Doffman)
+
2008-04-21 Johan Dahlin <johan@gnome.org>
* codegen/h2def.py: Update link to defs format discussion
diff --git a/gobject/pygenum.c b/gobject/pygenum.c
index 2d6c544..7de2b3b 100644
--- a/gobject/pygenum.c
+++ b/gobject/pygenum.c
@@ -40,7 +40,8 @@ pyg_enum_richcompare(PyGEnum *self, PyObject *other, int op)
if (PyObject_TypeCheck(other, &PyGEnum_Type) && ((PyGEnum*)other)->gtype != self->gtype) {
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);
+ if (PyErr_Warn(PyExc_Warning, warning))
+ return NULL;
}
return pyg_integer_richcompare((PyObject *)self, other, op);
diff --git a/gobject/pygflags.c b/gobject/pygflags.c
index 853f5c2..4f028b9 100644
--- a/gobject/pygflags.c
+++ b/gobject/pygflags.c
@@ -32,14 +32,18 @@
static PyObject *
pyg_flags_richcompare(PyGFlags *self, PyObject *other, int op)
{
+ static char warning[256];
+
if (!PyInt_Check(other)) {
Py_INCREF(Py_NotImplemented);
return Py_NotImplemented;
}
if (PyObject_TypeCheck(other, &PyGFlags_Type) && ((PyGFlags*)other)->gtype != self->gtype) {
- PyErr_Warn(PyExc_Warning, "comparing different flags types");
- return NULL;
+ g_snprintf(warning, sizeof(warning), "comparing different flags types: %s and %s",
+ g_type_name(self->gtype), g_type_name(((PyGFlags*)other)->gtype));
+ if (PyErr_Warn(PyExc_Warning, warning))
+ return NULL;
}
return pyg_integer_richcompare((PyObject *)self, other, op);