[libvirt] [libvirt-python PATCH] Improve error output when use getTime with a nonzero flags.

Luyao Huang lhuang at redhat.com
Thu Oct 16 08:32:09 UTC 2014


When give a nonzero flags to getTime, c_retval will get -1 and goto cleanup.
But py_retval still is NULL,so pass c_retval value to py_retval.
This will make the output message more correct.

error before use this patch:
SystemError: error return without exception set

after use the patch:
libvirtError: unsupported flags (0x1) in function qemuDomainGetTime

Signed-off-by: Luyao Huang <lhuang at redhat.com>
---
 libvirt-override.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libvirt-override.c b/libvirt-override.c
index 9ba87eb..eed8d50 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -7758,6 +7758,7 @@ libvirt_virDomainGetTime(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
     LIBVIRT_END_ALLOW_THREADS;
 
     if (c_retval < 0)
+	py_retval = libvirt_intWrap(c_retval);
         goto cleanup;
 
     if (!(pyobj_seconds = libvirt_longlongWrap(seconds)) ||
-- 
1.8.3.1




More information about the libvir-list mailing list