Skip to content

Commit 5d6228d

Browse files
nirspipo
authored andcommitted
Fix handling of optional params in blockCopy()
Commit 2b4bd07 (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 <[email protected]>
1 parent 54e4304 commit 5d6228d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libvirt-override.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8837,7 +8837,7 @@ libvirt_virDomainBlockCopy(PyObject *self ATTRIBUTE_UNUSED,
88378837
VIR_N_ELEMENTS(virPyDomainBlockCopyParams)) < 0) {
88388838
return NULL;
88398839
}
8840-
} else {
8840+
} else if (pyobj_dict != Py_None) {
88418841
PyErr_Format(PyExc_TypeError, "block params must be a dictionary");
88428842
return NULL;
88438843
}

0 commit comments

Comments
 (0)