mirror of
https://gitlab.com/libvirt/libvirt-python.git
synced 2025-08-03 08:21:58 +03:00
Report an error if registering an event loop twice
The C library will now ignore an attempt to register an event loop twice. It is unable to report an error in this case though due to the C API returning 'void'. To improve this we must manually report an error at the python level. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
@ -5427,13 +5427,12 @@ static PyObject *
|
|||||||
libvirt_virEventRegisterImpl(PyObject *self ATTRIBUTE_UNUSED,
|
libvirt_virEventRegisterImpl(PyObject *self ATTRIBUTE_UNUSED,
|
||||||
PyObject *args)
|
PyObject *args)
|
||||||
{
|
{
|
||||||
/* Unref the previously-registered impl (if any) */
|
if (addHandleObj || updateHandleObj || removeHandleObj ||
|
||||||
Py_XDECREF(addHandleObj);
|
addTimeoutObj || updateTimeoutObj || removeTimeoutObj) {
|
||||||
Py_XDECREF(updateHandleObj);
|
PyErr_SetString(PyExc_RuntimeError,
|
||||||
Py_XDECREF(removeHandleObj);
|
"Event loop is already registered");
|
||||||
Py_XDECREF(addTimeoutObj);
|
return NULL;
|
||||||
Py_XDECREF(updateTimeoutObj);
|
}
|
||||||
Py_XDECREF(removeTimeoutObj);
|
|
||||||
|
|
||||||
/* Parse and check arguments */
|
/* Parse and check arguments */
|
||||||
if (!PyArg_ParseTuple(args, (char *) "OOOOOO:virEventRegisterImpl",
|
if (!PyArg_ParseTuple(args, (char *) "OOOOOO:virEventRegisterImpl",
|
||||||
|
Reference in New Issue
Block a user