1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2025-08-04 12:21:57 +03:00

Fix handling of optional params in blockCopy()

Commit 2b4bd07e0a (Add check for params, nparams being a dictionary)
changed the way the optional params argument is treated. If
libvirt.virDomain.blockCopy() is called without specifying params,
params is None, and the call will fail with:

    TypeError: block params must be a dictionary

This is wrong as params is defined as kwarg, breaking existing libvirt
users like oVirt. Add a check for Py_None, so we accept either a dict or
None and fail with TypeError with anything else.

Resolves: https://bugzilla.redhat.com/1687114

Signed-off-by: Nir Soffer <nsoffer@redhat.com>
This commit is contained in:
Nir Soffer
2019-03-11 23:34:50 +02:00
committed by Peter Krempa
parent 54e430448e
commit 5d6228d417

View File

@ -8837,7 +8837,7 @@ libvirt_virDomainBlockCopy(PyObject *self ATTRIBUTE_UNUSED,
VIR_N_ELEMENTS(virPyDomainBlockCopyParams)) < 0) {
return NULL;
}
} else {
} else if (pyobj_dict != Py_None) {
PyErr_Format(PyExc_TypeError, "block params must be a dictionary");
return NULL;
}