gst/gstbus.override: Raise an exception if the callback doesn't return anything

Original commit message from CVS:
* gst/gstbus.override: (bus_handler) (bus_sync_handler):
Raise an exception if the callback doesn't return anything
* gst/pygstminiobject.c:
removed the 'ref' and 'unref' methods
This commit is contained in:
Edward Hervey 2005-07-13 10:05:59 +00:00
parent d32e28af85
commit 19dd2cc030
3 changed files with 19 additions and 19 deletions

View file

@ -1,3 +1,11 @@
2005-07-13 Edward Hervey <edward@fluendo.com>
* gst/gstbus.override: (bus_handler) (bus_sync_handler):
Raise an exception if the callback doesn't return anything
* gst/pygstminiobject.c:
removed the 'ref' and 'unref' methods
2005-07-13 Andy Wingo <wingo@pobox.com>
* examples/pipeline-tester: Tweaks, show messages.

View file

@ -55,7 +55,11 @@ bus_sync_handler (GstBus *bus, GstMessage *message, gpointer user_data)
PyErr_Print();
res = GST_BUS_PASS;
} else {
if (pyg_enum_get_value(GST_TYPE_BUS_SYNC_REPLY, ret, (gint *) &res))
if (ret == Py_None) {
PyErr_SetString(PyExc_TypeError, "callback should return a BusSyncReply");
PyErr_Print();
res = GST_BUS_PASS;
} else if (pyg_enum_get_value(GST_TYPE_BUS_SYNC_REPLY, ret, (gint *) &res))
res = GST_BUS_PASS;
Py_DECREF (ret);
}
@ -101,7 +105,12 @@ bus_handler (GstBus *bus, GstMessage *message, gpointer user_data)
PyErr_Print();
res = TRUE;
} else {
res = PyObject_IsTrue(ret);
if (ret == Py_None) {
PyErr_SetString(PyExc_TypeError, "callback should return True or False");
PyErr_Print();
res = TRUE;
} else
res = PyObject_IsTrue(ret);
Py_DECREF(ret);
}
Py_DECREF(args);

View file

@ -405,27 +405,10 @@ pygstminiobject_copy(PyGstMiniObject *self, PyObject *args)
return pygstminiobject_new(gst_mini_object_copy(self->obj));
}
static PyObject *
pygstminiobject_ref(PyGstMiniObject *self, PyObject *args)
{
gst_mini_object_ref(self->obj);
return (PyObject*) self;
}
static PyObject *
pygstminiobject_unref(PyGstMiniObject *self, PyObject *args)
{
gst_mini_object_ref(self->obj);
Py_INCREF(Py_None);
return Py_None;
}
static PyMethodDef pygstminiobject_methods[] = {
{ "__gstminiobject_init__", (PyCFunction)pygstminiobject__gstminiobject_init__,
METH_VARARGS|METH_KEYWORDS },
{ "copy", (PyCFunction)pygstminiobject_copy, METH_VARARGS, "Copies the miniobject"},
{ "ref", (PyCFunction)pygstminiobject_ref, METH_VARARGS, "Adds a reference to the miniobject" },
{ "unref", (PyCFunction)pygstminiobject_unref, METH_VARARGS, "Removes a reference from the miniobject"},
{ NULL, NULL, 0 }
};